diff --git a/src/App.tsx b/src/App.tsx
index 477c186..ea7dfd3 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -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 (
-
+
)
}
-
-export default App
diff --git a/src/components/Footer/Footer.tsx b/src/components/Footer/Footer.tsx
deleted file mode 100644
index d8dae48..0000000
--- a/src/components/Footer/Footer.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import { styled } from '@mui/material';
-
-export default function Footer() {
- return
- Made with 🌮 at elao - © 2024
- ;
-}
-
-const StyledFooter = styled('footer')(({ theme }) => theme.unstable_sx({
- display: 'flex',
- flexDirection: 'column',
- alignItems: 'center',
- color: theme.palette.common.white,
-}));
diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx
deleted file mode 100644
index df0f343..0000000
--- a/src/components/Header/Header.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import { styled } from '@mui/material';
-
-export default function Header() {
-
- return
-
- Ça mâche
- quoi ?
-
- ;
-}
-
-const StyledHeader = styled('header')(({ theme }) => theme.unstable_sx({
- '& h1': {
- margin: '60px 0px 130px 130px',
- fontSize: '52px',
- color: theme.palette.common.white,
- fontFamily: 'Poppins',
-
- '& span': {
- position: 'relative',
- zIndex: '1',
-
- '&:last-of-type': {
- top: '59px',
- right: '65px',
- },
-
- '&:before': {
- content: '""',
- position: 'absolute',
- top: '30px',
- left: '10px',
- width: '100%',
- height: '33px',
- background: theme.palette.secondary.light,
- zIndex: '-1',
- },
- },
- },
-}));
-
diff --git a/src/components/UI/Button.tsx b/src/components/UI/Button.tsx
new file mode 100644
index 0000000..77e08e7
--- /dev/null
+++ b/src/components/UI/Button.tsx
@@ -0,0 +1,27 @@
+import { PropsWithChildren } from 'react'
+import { styled } from '@mui/material'
+
+export default function Button({ children }: PropsWithChildren) {
+ return (
+
+ {children}
+
+ )
+}
+
+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,
+ },
+}));
diff --git a/src/components/UI/Button/ValidateButton.tsx b/src/components/UI/Button/ValidateButton.tsx
deleted file mode 100644
index 6dc2eb1..0000000
--- a/src/components/UI/Button/ValidateButton.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import { Fab, styled } from '@mui/material'
-
-const FabStyled = styled(Fab)(({ theme }) => ({
- position: 'fixed',
- right: 0,
- backgroundColor: theme.palette.primary.main,
- '&:hover': {
- backgroundColor: theme.palette.primary.light,
- },
-}));
-
-export default function ValidateButton() {
- return (
-
- Valider
-
- )
-}
diff --git a/src/components/UI/RestaurantCard.tsx b/src/components/UI/RestaurantCard.tsx
index e1383ab..51904dc 100644
--- a/src/components/UI/RestaurantCard.tsx
+++ b/src/components/UI/RestaurantCard.tsx
@@ -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 {
id: number
name: string
diff --git a/src/components/UI/food-option.tsx b/src/components/UI/food-option.tsx
new file mode 100644
index 0000000..47ba04a
--- /dev/null
+++ b/src/components/UI/food-option.tsx
@@ -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) {
+ if (e.target.checked) {
+ setPickedOptions([...pickedOptions, id]);
+ } else {
+ setPickedOptions(pickedOptions.filter(option => id !== option));
+ }
+ }
+
+ return <>
+
+
+ >;
+}
+
+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',
+}));
diff --git a/src/components/UI/ToggleSwitch.tsx b/src/components/UI/toggle-switch.tsx
similarity index 78%
rename from src/components/UI/ToggleSwitch.tsx
rename to src/components/UI/toggle-switch.tsx
index de0d500..326ff51 100644
--- a/src/components/UI/ToggleSwitch.tsx
+++ b/src/components/UI/toggle-switch.tsx
@@ -18,11 +18,7 @@ export default function ToggleSwitch({
}
return (
-
+
@@ -35,8 +31,9 @@ export default function ToggleSwitch({
const LabelStyled = styled(FormControlLabel)(({ theme }) => ({
- color: theme.palette.secondary.contrastText,
+ color: theme.palette.text.primary,
+
'& .MuiSwitch-track': {
- backgroundColor: theme.palette.secondary.contrastText,
+ backgroundColor: theme.palette.text.primary,
},
}));
diff --git a/src/components/footer/footer.tsx b/src/components/footer/footer.tsx
new file mode 100644
index 0000000..4b8f37c
--- /dev/null
+++ b/src/components/footer/footer.tsx
@@ -0,0 +1,15 @@
+import { styled } from '@mui/material'
+
+export default function Footer() {
+ return
+ Made with 🌮 at elao - © 2024
+ ;
+}
+
+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)',
+}));
\ No newline at end of file
diff --git a/src/components/header/header.tsx b/src/components/header/header.tsx
new file mode 100644
index 0000000..9166d28
--- /dev/null
+++ b/src/components/header/header.tsx
@@ -0,0 +1,45 @@
+import { styled } from '@mui/material'
+
+export default function Header() {
+ return
+
+ Ça mâche
+ quoi ?
+
+ ;
+}
+
+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',
+ },
+ },
+}));
diff --git a/src/data/food-options.ts b/src/data/food-options.ts
new file mode 100644
index 0000000..da25011
--- /dev/null
+++ b/src/data/food-options.ts
@@ -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;
diff --git a/src/data/restaurants.ts b/src/data/restaurants.ts
deleted file mode 100644
index 6adda7e..0000000
--- a/src/data/restaurants.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-const data = {
- "restaurants": [
- {
- "id": 1,
- "name": "Restaurant 1",
- "website": "https://mui.com/material-ui/react-card/",
- "image": "https://mui.com/static/images/cards/contemplative-reptile.jpg",
- },
- {
- "id": 2,
- "name": "Restaurant 2",
- "website": "https://mui.com/material-ui/react-card/",
- "image": "https://mui.com/static/images/cards/contemplative-reptile.jpg",
- },
- {
- "id": 3,
- "name": "Restaurant 3",
- "website": "https://mui.com/material-ui/react-card/",
- "image": "https://mui.com/static/images/cards/contemplative-reptile.jpg",
- },
- ],
-};
-
-export default data;
diff --git a/src/layouts/AppLayout.tsx b/src/layouts/AppLayout.tsx
deleted file mode 100644
index 91f808e..0000000
--- a/src/layouts/AppLayout.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import { PropsWithChildren } from 'react';
-import Header from '@app/components/Header/Header.tsx';
-import Footer from '@app/components/Footer/Footer.tsx';
-import { Container, styled } from '@mui/material';
-import background from '@images/background.svg';
-
-export default function AppLayout({ children }: PropsWithChildren) {
- return
-
-
- {children}
-
-
- ;
-}
-
-
-const StyledContainer = styled(Container)(({ theme }) => theme.unstable_sx({
- display: 'flex',
- flexDirection: 'column',
- minHeight: '100vh',
- minWidth: '100vw',
- main: {
- flex: 1,
- },
- backgroundImage: `url(${background})`,
- backgroundRepeat: 'no-repeat',
- backgroundPosition: 'right bottom',
- backgroundSize: 'auto 100%',
- backgroundColor: theme.palette.secondary.main,
-}))
diff --git a/src/layouts/app-layout.tsx b/src/layouts/app-layout.tsx
new file mode 100644
index 0000000..1f2f6b1
--- /dev/null
+++ b/src/layouts/app-layout.tsx
@@ -0,0 +1,30 @@
+import { PropsWithChildren } from 'react'
+import Header from '@app/components/header/header.tsx'
+import Footer from '@app/components/footer/footer.tsx'
+import { styled } from '@mui/material'
+import background from '@images/background.svg'
+
+export default function AppLayout({ children }: PropsWithChildren) {
+ return
+
+
+ {children}
+
+
+ ;
+}
+
+const Container = styled('div')(({ theme }) => ({
+ padding: `0 ${theme.spacing(4.5)}`,
+ display: 'flex',
+ flexDirection: 'column',
+ minHeight: '100vh',
+ height: '100vh',
+ minWidth: '100vw',
+ background: `${theme.palette.background.default} url(${background}) no-repeat right bottom`,
+ overflow: 'auto',
+}));
+
+const Main = styled('main')(() => ({
+ flex: '1',
+}));
diff --git a/src/main.tsx b/src/main.tsx
index 55f60f5..80ca9ce 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -1,7 +1,7 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from '@app/App.tsx'
-import '@assets/app.scss';
+import '@assets/app.scss'
ReactDOM.createRoot(document.getElementById('root')!).render(
diff --git a/src/pages/RestaurantsOptions.tsx b/src/pages/RestaurantsOptions.tsx
deleted file mode 100644
index 38861ea..0000000
--- a/src/pages/RestaurantsOptions.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-import { Box, styled } from '@mui/material';
-import { useEffect, useState } from 'react';
-import data from '@app/data/restaurants.ts';
-import { RestaurantButton } from '@app/components/UI/Button/RestaurantButton.tsx';
-import ToggleSwitch from '@app/components/UI/ToggleSwitch.tsx';
-import ValidateButton from '@app/components/UI/Button/ValidateButton.tsx';
-
-export interface Restaurant {
- id: number
- name: string
- website: string
- image: string
-}
-
-export default function RestaurantsOptions() {
- const [pickedRestaurantIds, setPickedRestaurantIds] = useState([]);
- const [allSelected, setAllSelected] = useState(false);
-
- const dataRestaurants = data.restaurants;
-
- useEffect(() => {
- if (allSelected) {
- setPickedRestaurantIds(dataRestaurants.map(restaurant => restaurant.id));
- } else {
- setPickedRestaurantIds([]);
- }
- },[allSelected, dataRestaurants]);
-
- return <>
-
-
-
- {dataRestaurants && dataRestaurants.map((restaurant: Restaurant) => {
- return
- })}
-
- >
-}
-
-const StyledContainer = styled(Box)(({ theme }) => theme.unstable_sx({
- display: 'flex',
-}));
-
diff --git a/src/pages/options-list.tsx b/src/pages/options-list.tsx
new file mode 100644
index 0000000..0067ed7
--- /dev/null
+++ b/src/pages/options-list.tsx
@@ -0,0 +1,67 @@
+import { useEffect, useState } from 'react'
+import ToggleSwitch from '@app/components/UI/toggle-switch.tsx'
+import Button from '@app/components/UI/Button.tsx'
+import FoodOption from '@app/components/UI/food-option.tsx'
+import data from '@app/data/food-options.ts'
+import { styled } from '@mui/material'
+
+export interface FoodOption {
+ id: string
+ label: string
+ icon: string
+}
+
+export default function OptionsList() {
+ const [pickedOptions, setPickedOptions] = useState([]);
+ const [allSelected, setAllSelected] = useState(false);
+
+ const foodOptions = data.foodOptions;
+
+ useEffect(() => {
+ if (allSelected) {
+ setPickedOptions(foodOptions.map(option => option.id));
+ } else {
+ setPickedOptions([]);
+ }
+ },[allSelected, foodOptions]);
+
+ return <>
+
+
+
+ {foodOptions && foodOptions.map((option: FoodOption) => {
+ return
+ })}
+
+
+
+
+
+ >
+}
+
+const Wrapper = styled('div')(({ theme }) => ({
+ margin: `${theme.spacing} 0 ${theme.spacing(3)}`,
+ width: '60%',
+ display: 'flex',
+ flexDirection: 'column',
+ gap: '2rem',
+}));
+
+const Columns = styled('div')(() => ({
+ display: 'grid',
+ gridTemplateColumns: 'repeat(2, 1fr)',
+ gap: '1.5rem',
+}));
+
+const ButtonWrapper = styled('div')(() => ({
+ display: 'flex',
+ justifyContent: 'flex-end',
+}));
diff --git a/src/theme.ts b/src/theme.ts
index 65fdf02..7ea609f 100644
--- a/src/theme.ts
+++ b/src/theme.ts
@@ -50,22 +50,25 @@ const theme = createTheme({
export const customTheme = createTheme({
...theme,
palette: {
- primary: {
- main: '#5135d1',
- dark: '#3e2ca1',
- light: '#bdb3ec',
- contrastText: '#181A41',
+ primary: { // bright blue
+ main: '#0460fc',
+ dark: '#143374',
},
- secondary: {
- main: '#181a41',
- dark: '#2b2371',
- light: '#3e2ca1',
- contrastText: '#f3f2f9',
+ secondary: { // dark blue
+ main: '#12122d',
+ light: '#20203f',
},
- common: {
- white: '#FFFFFF',
- black: '#0C0D24',
+ background: {
+ default: '#161a3d', // dark background
+ paper: '#0460fc', // bright background
},
+ text: {
+ primary: '#fff',
+ },
+ },
+ shape: {
+ borderRadius: 20,
},
+ spacing: 20,
});