Skip to content

Commit bcbd133

Browse files
author
Amélie
committed
Use MUI color theme
1 parent 3c21bd2 commit bcbd133

File tree

12 files changed

+173
-166
lines changed

12 files changed

+173
-166
lines changed

src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import '@assets/app.scss'
2-
import AppLayout from '@app/layouts/AppLayout.tsx';
2+
import AppLayout from '@app/layouts/app-layout.tsx';
33
import { ThemeProvider } from '@mui/material/styles';
44
import { CssBaseline } from '@mui/material';
55
import { customTheme } from '@app/theme.ts';

src/components/Footer/footer.tsx

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/components/Header/header.tsx

Lines changed: 0 additions & 45 deletions
This file was deleted.

src/components/UI/Button.tsx

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { PropsWithChildren } from 'react'
2-
import styled from '@emotion/styled'
2+
import { styled } from '@mui/material'
33

44
export default function Button({ children }: PropsWithChildren) {
55
return (
@@ -9,20 +9,19 @@ export default function Button({ children }: PropsWithChildren) {
99
)
1010
}
1111

12-
const Wrapper = styled.button`
13-
height: 60px;
14-
padding: 0 55px;
15-
font-size: 18px;
16-
color: #fff;
17-
font-weight: bold;
18-
background: #0460FC;
19-
border: none;
20-
border-radius: 20px;
21-
cursor: pointer;
22-
transition: all .2s;
23-
24-
&:hover,
25-
&:focus {
26-
background: #0052dd;
27-
}
28-
`
12+
const Wrapper = styled('button')(({ theme }) => ({
13+
height: '60px',
14+
padding: `0 ${theme.spacing(2.5)}`,
15+
fontSize: '18px',
16+
color: theme.palette.text.primary,
17+
fontWeight: 'bold',
18+
background: theme.palette.primary.main,
19+
border: 'none',
20+
borderRadius: theme.shape.borderRadius,
21+
cursor: 'pointer',
22+
transition: 'all .2s',
23+
24+
'&:hover, &:focus': {
25+
background: theme.palette.primary.dark,
26+
},
27+
}));

src/components/UI/food-option.tsx

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'
2-
import styled from '@emotion/styled'
2+
import { styled } from '@mui/material'
33

44
type Props = {
55
id: string
@@ -29,35 +29,35 @@ export default function FoodOption({ id, label, icon, pickedOptions, setPickedOp
2929
</>;
3030
}
3131

32-
const Label = styled.label`
33-
padding: 30px;
34-
height: 75px;
35-
display: flex;
36-
align-items: center;
37-
gap: 1rem;
38-
font-size: 1.1rem;
39-
color: #fff;
40-
background: #12122d;
41-
border: solid 2px #20203f;
42-
border-radius: 20px;
43-
cursor: pointer;
44-
transition: all .2s;
45-
46-
&:hover,
47-
&:focus {
48-
border-color: #0460fc;
49-
}
50-
51-
input:checked, .checked + & {
52-
background: #143374;
53-
border-color: #0460fc;
54-
}
55-
`
32+
const Label = styled('label')(({ theme }) => ({
33+
padding: theme.spacing(1.5),
34+
height: '75px',
35+
display: 'flex',
36+
alignItems: 'center',
37+
gap: '1rem',
38+
fontSize: '1.1rem',
39+
color: theme.palette.text.primary,
40+
background: theme.palette.secondary.main,
41+
border: 'solid 2px',
42+
borderColor: theme.palette.secondary.light,
43+
borderRadius: theme.shape.borderRadius,
44+
cursor: 'pointer',
45+
transition: 'all .2s',
46+
47+
'&:hover, &:focus': {
48+
borderColor: theme.palette.primary.main,
49+
},
50+
51+
'input:checked, .checked + &': {
52+
background: theme.palette.primary.dark,
53+
borderColor: theme.palette.primary.main,
54+
},
55+
}));
5656

57-
const Icon = styled.span`
58-
font-size: 2rem;
59-
`
57+
const Icon = styled('span')(() => ({
58+
fontSize: '2rem',
59+
}));
6060

61-
const Input = styled.input`
62-
display: none;
63-
`
61+
const Input = styled('input')(() => ({
62+
display: 'none',
63+
}));

src/components/UI/toggle-switch.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ export default function ToggleSwitch({
3131

3232

3333
const LabelStyled = styled(FormControlLabel)(({ theme }) => ({
34-
color: theme.palette.secondary.contrastText,
34+
color: theme.palette.text.primary,
35+
3536
'& .MuiSwitch-track': {
36-
backgroundColor: theme.palette.secondary.contrastText,
37+
backgroundColor: theme.palette.text.primary,
3738
},
3839
}));

src/components/footer/footer.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { styled } from '@mui/material'
2+
3+
export default function Footer() {
4+
return <Wrapper role="contentinfo">
5+
Made with 🌮 at elao - © 2024
6+
</Wrapper>;
7+
}
8+
9+
const Wrapper = styled('footer')(({ theme }) => ({
10+
marginTop: theme.spacing(2),
11+
padding: `${theme.spacing(1)} 0`,
12+
color: theme.palette.text.primary,
13+
textAlign: 'center',
14+
borderTop: 'solid 1px rgba(146, 148, 175, .2)',
15+
}));

src/components/header/header.tsx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { styled } from '@mui/material'
2+
3+
export default function Header() {
4+
return <Wrapper>
5+
<Title>
6+
<span>Ça mâche</span>
7+
<span>quoi ?</span>
8+
</Title>
9+
</Wrapper>;
10+
}
11+
12+
const Wrapper = styled('header')(() => ({
13+
padding: '100px 0 80px',
14+
width: '60%',
15+
}));
16+
17+
const Title = styled('h1')(({ theme }) => ({
18+
margin: `0 0 0 ${theme.spacing(1)}`,
19+
display: 'flex',
20+
flexDirection: 'column',
21+
alignItems: 'flex-start',
22+
fontSize: '3.25rem',
23+
lineHeight: '1.1',
24+
color: theme.palette.text.primary,
25+
26+
'span': {
27+
position: 'relative',
28+
zIndex: '1',
29+
30+
'&::before': {
31+
height: '2rem',
32+
width: '100%',
33+
position: 'absolute',
34+
bottom: '.2rem',
35+
left: '.5rem',
36+
content: '""',
37+
zIndex: '-1',
38+
background: theme.palette.background.paper,
39+
},
40+
41+
'&:last-of-type': {
42+
marginLeft: '13rem',
43+
},
44+
},
45+
}));

src/layouts/AppLayout.tsx

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/layouts/app-layout.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { PropsWithChildren } from 'react'
2+
import Header from '@app/components/header/header.tsx'
3+
import Footer from '@app/components/footer/footer.tsx'
4+
import { styled } from '@mui/material'
5+
import background from '@images/background.svg'
6+
7+
export default function AppLayout({ children }: PropsWithChildren) {
8+
return <Container>
9+
<Header />
10+
<Main>
11+
{children}
12+
</Main>
13+
<Footer />
14+
</Container>;
15+
}
16+
17+
const Container = styled('div')(({ theme }) => ({
18+
padding: `0 ${theme.spacing(4.5)}`,
19+
display: 'flex',
20+
flexDirection: 'column',
21+
minHeight: '100vh',
22+
height: '100vh',
23+
minWidth: '100vw',
24+
background: `${theme.palette.background.default} url(${background}) no-repeat right bottom`,
25+
overflow: 'auto',
26+
}));
27+
28+
const Main = styled('main')(() => ({
29+
flex: '1',
30+
}));

0 commit comments

Comments
 (0)