-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4948 from marmelab/example-demo-ui
De-googleify e-commerce demo
- Loading branch information
Showing
18 changed files
with
341 additions
and
319 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,70 @@ | ||
import * as React from 'react'; | ||
import { FC, createElement } from 'react'; | ||
import { Card, makeStyles, Box, Typography, Divider } from '@material-ui/core'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
import cartouche from './cartouche.png'; | ||
import cartoucheDark from './cartoucheDark.png'; | ||
|
||
interface Props { | ||
icon: FC<any>; | ||
to: string; | ||
title?: string; | ||
subtitle?: string | number; | ||
} | ||
|
||
const useStyles = makeStyles(theme => ({ | ||
card: { | ||
minHeight: 52, | ||
flex: '1', | ||
'& a': { | ||
textDecoration: 'none', | ||
color: 'inherit', | ||
}, | ||
}, | ||
main: (props: Props) => ({ | ||
overflow: 'inherit', | ||
padding: 16, | ||
background: `url(${ | ||
theme.palette.type === 'dark' ? cartoucheDark : cartouche | ||
}) no-repeat`, | ||
display: 'flex', | ||
justifyContent: 'space-between', | ||
alignItems: 'center', | ||
'& .icon': { | ||
color: theme.palette.type === 'dark' ? 'inherit' : '#dc2440', | ||
}, | ||
}), | ||
title: {}, | ||
})); | ||
|
||
const CardWithIcon: FC<Props> = props => { | ||
const { icon, title, subtitle, to, children } = props; | ||
const classes = useStyles(props); | ||
return ( | ||
<Card className={classes.card}> | ||
<Link to={to}> | ||
<div className={classes.main}> | ||
<Box width="3em" className="icon"> | ||
{createElement(icon, { fontSize: 'large' })} | ||
</Box> | ||
<Box textAlign="right"> | ||
<Typography | ||
className={classes.title} | ||
color="textSecondary" | ||
> | ||
{title} | ||
</Typography> | ||
<Typography variant="h5" component="h2"> | ||
{subtitle || ' '} | ||
</Typography> | ||
</Box> | ||
</div> | ||
</Link> | ||
{children && <Divider />} | ||
{children} | ||
</Card> | ||
); | ||
}; | ||
|
||
export default CardWithIcon; |
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
Oops, something went wrong.