-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: info page redesign * feat: add chequebook card
- Loading branch information
1 parent
41432bc
commit caea5ae
Showing
5 changed files
with
214 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { createStyles, makeStyles, Theme, Typography } from '@material-ui/core' | ||
import { ReactElement } from 'react' | ||
import { AlertCircle, Check } from 'react-feather' | ||
import { SwarmButton, SwarmButtonProps } from './SwarmButton' | ||
|
||
interface Props { | ||
icon: ReactElement | ||
title: string | ||
subtitle: string | ||
buttonProps: SwarmButtonProps | ||
status: 'ok' | 'error' | ||
} | ||
|
||
const useStyles = (backgroundColor: string) => | ||
makeStyles((theme: Theme) => | ||
createStyles({ | ||
root: { | ||
flexGrow: 1, | ||
flexBasis: '100px', | ||
}, | ||
wrapper: { | ||
backgroundColor, | ||
padding: '16px', | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
textAlign: 'center', | ||
}, | ||
iconWrapper: { | ||
display: 'flex', | ||
alignItems: 'flex-start', | ||
marginBottom: '18px', | ||
}, | ||
button: { | ||
width: '100%', | ||
marginTop: '2px', | ||
backgroundColor, | ||
'&:hover': { | ||
backgroundColor: theme.palette.primary.main, | ||
color: 'white', | ||
boxShadow: 'none', | ||
// https://github.com/mui-org/material-ui/issues/22543 | ||
'@media (hover: none)': { | ||
backgroundColor: theme.palette.primary.main, | ||
color: 'white', | ||
boxShadow: 'none', | ||
}, | ||
}, | ||
}, | ||
}), | ||
) | ||
|
||
export default function Card({ buttonProps, icon, title, subtitle, status }: Props): ReactElement { | ||
const backgroundColor = status === 'error' ? 'white' : '#f3f3f3' | ||
const { className, ...rest } = buttonProps | ||
const classes = useStyles(backgroundColor)() | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<div className={classes.wrapper}> | ||
<div className={classes.iconWrapper}> | ||
{icon} | ||
{status === 'ok' ? ( | ||
<Check size="13" stroke="#09ca6c" /> | ||
) : ( | ||
<AlertCircle size="13" fill="#f44336" stroke="white" /> | ||
)} | ||
</div> | ||
<Typography variant="h2" style={{ marginBottom: '8px' }}> | ||
{title} | ||
</Typography> | ||
<Typography variant="caption">{subtitle}</Typography> | ||
</div> | ||
<SwarmButton className={[classes.button, className].join(' ')} {...rest} /> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { ReactElement, CSSProperties } from 'react' | ||
|
||
interface Props { | ||
style?: CSSProperties | ||
} | ||
|
||
export default function Card({ style }: Props): ReactElement { | ||
return <div style={Object.assign({}, style, { width: '100%', height: '380px', backgroundColor: '#f3f3f3' })}></div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters