-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace restaurants with food options and update components styles #7
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,17 @@ | ||
import '@assets/app.scss' | ||
import AppLayout from '@app/layouts/AppLayout.tsx'; | ||
import AppLayout from '@app/layouts/app-layout.tsx'; | ||
import { ThemeProvider } from '@mui/material/styles'; | ||
import { CssBaseline } from '@mui/material'; | ||
import { customTheme } from '@app/theme.ts'; | ||
import RestaurantsOptions from '@app/pages/RestaurantsOptions.tsx'; | ||
|
||
function App() { | ||
import OptionsList from '@app/pages/options-list.tsx'; | ||
|
||
export default function App() { | ||
return ( | ||
<ThemeProvider theme={customTheme}> | ||
<CssBaseline /> | ||
<AppLayout> | ||
<RestaurantsOptions /> | ||
<OptionsList /> | ||
</AppLayout> | ||
</ThemeProvider> | ||
) | ||
} | ||
|
||
export default App |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { PropsWithChildren } from 'react' | ||
import { styled } from '@mui/material' | ||
|
||
export default function Button({ children }: PropsWithChildren) { | ||
return ( | ||
<Wrapper> | ||
{children} | ||
</Wrapper> | ||
) | ||
} | ||
|
||
const Wrapper = styled('button')(({ theme }) => ({ | ||
height: '60px', | ||
padding: `0 ${theme.spacing(2.5)}`, | ||
fontSize: '18px', | ||
color: theme.palette.text.primary, | ||
fontWeight: 'bold', | ||
background: theme.palette.primary.main, | ||
border: 'none', | ||
borderRadius: theme.shape.borderRadius, | ||
cursor: 'pointer', | ||
transition: 'all .2s', | ||
|
||
'&:hover, &:focus': { | ||
background: theme.palette.primary.dark, | ||
}, | ||
})); |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { Button, Card, CardActions, CardContent, CardMedia, Typography } from '@mui/material'; | ||
import ToggleSwitch from '@app/components/UI/ToggleSwitch.tsx'; | ||
|
||
import { Button, Card, CardActions, CardContent, CardMedia, Typography } from '@mui/material' | ||
import ToggleSwitch from '@app/components/UI/toggle-switch.tsx' | ||
|
||
// TODO: Unused component, keep for future version ? | ||
interface Props { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oui, au cas où... M'enfin ça partira dans l'été si on n'en a pas l'utilité 👍 |
||
id: number | ||
name: string | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import React from 'react' | ||
import { styled } from '@mui/material' | ||
|
||
type Props = { | ||
id: string | ||
label: string | ||
icon: string | ||
pickedOptions: string[] | ||
setPickedOptions: (options: string[]) => void | ||
} | ||
|
||
export default function FoodOption({ id, label, icon, pickedOptions, setPickedOptions }: Props) { | ||
const checked = pickedOptions.includes(id); | ||
|
||
function handleChange(e: React.ChangeEvent<HTMLInputElement>) { | ||
if (e.target.checked) { | ||
setPickedOptions([...pickedOptions, id]); | ||
} else { | ||
setPickedOptions(pickedOptions.filter(option => id !== option)); | ||
} | ||
} | ||
|
||
return <> | ||
<Input type="checkbox" id={label} onChange={handleChange} className={checked ? 'checked' : ''} /> | ||
<Label htmlFor={label} > | ||
<Icon>{icon}</Icon> | ||
{label} | ||
</Label> | ||
</>; | ||
} | ||
|
||
const Label = styled('label')(({ theme }) => ({ | ||
padding: theme.spacing(1.5), | ||
height: '75px', | ||
display: 'flex', | ||
alignItems: 'center', | ||
gap: '1rem', | ||
fontSize: '1.1rem', | ||
color: theme.palette.text.primary, | ||
background: theme.palette.secondary.main, | ||
border: 'solid 2px', | ||
borderColor: theme.palette.secondary.light, | ||
borderRadius: theme.shape.borderRadius, | ||
cursor: 'pointer', | ||
transition: 'all .2s', | ||
|
||
'&:hover, &:focus': { | ||
borderColor: theme.palette.primary.main, | ||
}, | ||
|
||
'input:checked, .checked + &': { | ||
background: theme.palette.primary.dark, | ||
borderColor: theme.palette.primary.main, | ||
}, | ||
})); | ||
|
||
const Icon = styled('span')(() => ({ | ||
fontSize: '2rem', | ||
})); | ||
|
||
const Input = styled('input')(() => ({ | ||
display: 'none', | ||
})); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { styled } from '@mui/material' | ||
|
||
export default function Footer() { | ||
return <Wrapper role="contentinfo"> | ||
Made with 🌮 at elao - © 2024 | ||
</Wrapper>; | ||
} | ||
|
||
const Wrapper = styled('footer')(({ theme }) => ({ | ||
marginTop: theme.spacing(2), | ||
padding: `${theme.spacing(1)} 0`, | ||
color: theme.palette.text.primary, | ||
textAlign: 'center', | ||
borderTop: 'solid 1px rgba(146, 148, 175, .2)', | ||
})); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { styled } from '@mui/material' | ||
|
||
export default function Header() { | ||
return <Wrapper> | ||
<Title> | ||
<span>Ça mâche</span> | ||
<span>quoi ?</span> | ||
</Title> | ||
</Wrapper>; | ||
} | ||
|
||
const Wrapper = styled('header')(() => ({ | ||
padding: '100px 0 80px', | ||
width: '60%', | ||
})); | ||
|
||
const Title = styled('h1')(({ theme }) => ({ | ||
margin: `0 0 0 ${theme.spacing(1)}`, | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'flex-start', | ||
fontSize: '3.25rem', | ||
lineHeight: '1.1', | ||
color: theme.palette.text.primary, | ||
|
||
'span': { | ||
position: 'relative', | ||
zIndex: '1', | ||
|
||
'&::before': { | ||
height: '2rem', | ||
width: '100%', | ||
position: 'absolute', | ||
bottom: '.2rem', | ||
left: '.5rem', | ||
content: '""', | ||
zIndex: '-1', | ||
background: theme.palette.background.paper, | ||
}, | ||
|
||
'&:last-of-type': { | ||
marginLeft: '13rem', | ||
}, | ||
}, | ||
})); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const data = { | ||
"foodOptions": [ | ||
{ | ||
"id": "1", | ||
"label": "Sushi", | ||
"icon": "🍣", | ||
}, | ||
{ | ||
"id": "2", | ||
"label": "Salade", | ||
"icon": "🥬", | ||
}, | ||
{ | ||
"id": "3", | ||
"label": "Pizza", | ||
"icon": "🍕", | ||
}, | ||
{ | ||
"id": "4", | ||
"label": "Burger", | ||
"icon": "🍔", | ||
}, | ||
{ | ||
"id": "5", | ||
"label": "Kebab", | ||
"icon": "🥙", | ||
}, | ||
{ | ||
"id": "6", | ||
"label": "Formule boulangerie", | ||
"icon": "🥖", | ||
}, | ||
], | ||
}; | ||
|
||
export default data; |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C'est une nouvelle pratique d'ajouter des tirets et retirer les majuscules ? :o Je découvre
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah bah alors aucune idée, c'est comme ça sur Rigby et je sais pas si ça vient de nos pratiques ou des leurs ! Là bas les noms de fichiers sont en kebab case et les composants en pascal case, j'ai fait pareil 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'invoque @ogizanagi 🧞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah non, ce sont des pratiques propres à Rigby (une préférence de Guillaume par rapport à des soucis de casse sur Windows qu'il a pu rencontrer). On s'est alignés sur le projet, mais je suis pour conserver du PascalCase pour les composants et leurs noms de fichier chez nous 😃
(le kebab-case peut-être conservé mais plutôt pour des dossiers, pas des fichiers)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Team Pascal et pas kebab, c'est noté 🌮