Skip to content

Instantly share code, notes, and snippets.

@adrianhajdin
Created November 28, 2020 16:30
Show Gist options
  • Save adrianhajdin/9867aefce5318f27c95990553f428c6e to your computer and use it in GitHub Desktop.
Save adrianhajdin/9867aefce5318f27c95990553f428c6e to your computer and use it in GitHub Desktop.
Styles for an E-Commerce Web Tutorial
import { makeStyles } from '@material-ui/core/styles';
export default makeStyles(() => ({
media: {
height: 260,
},
cardContent: {
display: 'flex',
justifyContent: 'space-between',
},
cartActions: {
justifyContent: 'space-between',
},
buttons: {
display: 'flex',
alignItems: 'center',
},
}));
import { makeStyles } from '@material-ui/core/styles';
export default makeStyles((theme) => ({
toolbar: theme.mixins.toolbar,
title: {
marginTop: '5%',
},
emptyButton: {
minWidth: '150px',
[theme.breakpoints.down('xs')]: {
marginBottom: '5px',
},
[theme.breakpoints.up('xs')]: {
marginRight: '20px',
},
},
checkoutButton: {
minWidth: '150px',
},
link: {
textDecoration: 'none',
},
cardDetails: {
display: 'flex',
marginTop: '10%',
width: '100%',
justifyContent: 'space-between',
},
}));
import { makeStyles } from '@material-ui/core/styles';
export default makeStyles((theme) => ({
appBar: {
position: 'relative',
},
toolbar: theme.mixins.toolbar,
layout: {
marginTop: '5%',
width: 'auto',
marginLeft: theme.spacing(2),
marginRight: theme.spacing(2),
[theme.breakpoints.up(600 + theme.spacing(2) * 2)]: {
width: 600,
marginLeft: 'auto',
marginRight: 'auto',
},
},
paper: {
marginTop: theme.spacing(3),
marginBottom: theme.spacing(3),
padding: theme.spacing(2),
[theme.breakpoints.down('xs')]: {
width: '100%',
marginTop: 60,
},
[theme.breakpoints.up(600 + theme.spacing(3) * 2)]: {
marginTop: theme.spacing(6),
marginBottom: theme.spacing(6),
padding: theme.spacing(3),
},
},
stepper: {
padding: theme.spacing(3, 0, 5),
},
buttons: {
display: 'flex',
justifyContent: 'flex-end',
},
button: {
marginTop: theme.spacing(3),
marginLeft: theme.spacing(1),
},
divider: {
margin: '20px 0',
},
spinner: {
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
},
}));
import { makeStyles, fade } from '@material-ui/core/styles';
const drawerWidth = 0;
export default makeStyles((theme) => ({
appBar: {
boxShadow: 'none',
borderBottom: '1px solid rgba(0, 0, 0, 0.12)',
[theme.breakpoints.up('sm')]: {
width: `calc(100% - ${drawerWidth}px)`,
marginLeft: drawerWidth,
},
},
title: {
flexGrow: 1,
alignItems: 'center',
display: 'flex',
textDecoration: 'none',
},
image: {
marginRight: '10px',
},
menuButton: {
marginRight: theme.spacing(2),
[theme.breakpoints.up('sm')]: {
display: 'none',
},
},
grow: {
flexGrow: 1,
},
search: {
position: 'relative',
borderRadius: theme.shape.borderRadius,
backgroundColor: fade(theme.palette.common.white, 0.15),
'&:hover': {
backgroundColor: fade(theme.palette.common.white, 0.25),
},
marginRight: theme.spacing(2),
marginLeft: 0,
width: '100%',
[theme.breakpoints.up('sm')]: {
width: 'auto',
},
},
searchIcon: {
padding: theme.spacing(0, 2),
height: '100%',
position: 'absolute',
pointerEvents: 'none',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
},
inputRoot: {
color: 'inherit',
},
inputInput: {
padding: theme.spacing(1, 1, 1, 0),
// vertical padding + font size from searchIcon
paddingLeft: `calc(1em + ${theme.spacing(4)}px)`,
transition: theme.transitions.create('width'),
width: '100%',
[theme.breakpoints.up('md')]: {
width: '20ch',
},
},
}));
import { makeStyles } from '@material-ui/core/styles';
export default makeStyles((theme) => ({
toolbar: theme.mixins.toolbar,
content: {
flexGrow: 1,
backgroundColor: theme.palette.background.default,
padding: theme.spacing(3),
},
root: {
flexGrow: 1,
},
}));
import { makeStyles } from '@material-ui/core/styles';
export default makeStyles(() => ({
root: {
maxWidth: '100%',
},
media: {
height: 0,
paddingTop: '56.25%', // 16:9
},
cardActions: {
display: 'flex',
justifyContent: 'flex-end',
},
cardContent: {
display: 'flex',
justifyContent: 'space-between',
},
}));
@HarshitJajoria
Copy link

guys in which folder to add these files please help

@ramzy1453
Copy link

this is where you want the main thing it should be inside the src/
for example you can put them in a styles/folder inside the src/

@karimi-wahid
Copy link

productStyles.js
here background color doesn't apply.

@fronas
Copy link

fronas commented Aug 30, 2023

hello i am not able to install these two please help :

npm install @material-ui/core and @material-ui/icons

@TobiShina
Copy link

Great work

@TobiShina
Copy link

hello i am not able to install these two please help :

npm install @material-ui/core and @material-ui/icons

go to MaterialUi homepage from your browser and get the updated installation syntax

@fronas
Copy link

fronas commented Sep 26, 2023

@TobiShina : thanks i will try

@Rajesh-Dev-2002
Copy link

Thank you very much

@Sagarbisht99
Copy link

this is so helpful thing

@Sagarbisht99
Copy link

go to he material ui website and get the updated version of npm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment