diff --git a/README.md b/README.md
index 02aac3f..06b2023 100644
--- a/README.md
+++ b/README.md
@@ -1,70 +1,2 @@
-# Getting Started with Create React App
-
-This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
-
-## Available Scripts
-
-In the project directory, you can run:
-
-### `yarn start`
-
-Runs the app in the development mode.\
-Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
-
-The page will reload if you make edits.\
-You will also see any lint errors in the console.
-
-### `yarn test`
-
-Launches the test runner in the interactive watch mode.\
-See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
-
-### `yarn build`
-
-Builds the app for production to the `build` folder.\
-It correctly bundles React in production mode and optimizes the build for the best performance.
-
-The build is minified and the filenames include the hashes.\
-Your app is ready to be deployed!
-
-See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
-
-### `yarn eject`
-
-**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
-
-If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
-
-Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
-
-You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
-
-## Learn More
-
-You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
-
-To learn React, check out the [React documentation](https://reactjs.org/).
-
-### Code Splitting
-
-This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
-
-### Analyzing the Bundle Size
-
-This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
-
-### Making a Progressive Web App
-
-This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
-
-### Advanced Configuration
-
-This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
-
-### Deployment
-
-This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
-
-### `yarn build` fails to minify
-
-This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
+# magic-kebab
+Site sous React de restauration avec personnalisation de commande
diff --git a/README.old.md b/README.old.md
deleted file mode 100644
index 06b2023..0000000
--- a/README.old.md
+++ /dev/null
@@ -1,2 +0,0 @@
-# magic-kebab
-Site sous React de restauration avec personnalisation de commande
diff --git a/public/index.html b/public/index.html
index aa069f2..3236215 100644
--- a/public/index.html
+++ b/public/index.html
@@ -2,7 +2,7 @@
-
+
- React App
+ Magic Kebab
You need to enable JavaScript to run this app.
diff --git a/public/logo.svg b/public/logo.svg
new file mode 100644
index 0000000..f322e43
--- /dev/null
+++ b/public/logo.svg
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/public/public.css b/public/public.css
new file mode 100644
index 0000000..b5c61c9
--- /dev/null
+++ b/public/public.css
@@ -0,0 +1,3 @@
+@tailwind base;
+@tailwind components;
+@tailwind utilities;
diff --git a/src/App.js b/src/App.js
deleted file mode 100644
index 3784575..0000000
--- a/src/App.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import logo from './logo.svg';
-import './App.css';
-
-function App() {
- return (
-
- );
-}
-
-export default App;
diff --git a/src/App.jsx b/src/App.jsx
new file mode 100644
index 0000000..4fc6ea5
--- /dev/null
+++ b/src/App.jsx
@@ -0,0 +1,155 @@
+import * as React from "react";
+import "./index.css";
+
+// Components
+// import { Loading } from "./components/Loading";
+import { Navbar } from "./components/Navbar";
+import { IngredientBox } from "./components/IngredientBox";
+import { Button } from "./components/Button";
+
+import { defaultOrder, defaultBreads, defaultMeats, defaultVegetables, defaultSauces } from "./data";
+
+function App() {
+ const [currentOrder, setCurrentOrder] = React.useState(defaultOrder);
+ const [isLoading, setIsLoading] = React.useState(true);
+ const [timerHandle, setTimerHandle] = React.useState(null);
+ const [orderDisplay, setOrderDisplay] = React.useState({bread: true, meat: false, vegetables: false, sauces: false});
+ const [orderLimited, setOrderLimited] = React.useState({"vegetables": { limited: false, amount: 3}, "sauces": { limited: false, amount: 2}});
+
+ React.useEffect(() => {
+ setTimerHandle(setTimeout(() => setIsLoading(false), 2500));
+ return () => {
+ clearTimeout(timerHandle);
+ setTimerHandle(null);
+ };
+ }, [setTimerHandle]);
+
+ if (isLoading) { return ( its loading
); }
+
+ const handleOnSelected = (ingredient, value, display) => {
+ const newOrder = {...currentOrder};
+ newOrder[ingredient] = value;
+ setCurrentOrder(newOrder);
+ if (display) { handleDisplay(display.hide, display.show); }
+ }
+
+ const handleOnAdded = (ingredient, value) => {
+ if (handleOrderLimited(ingredient)) { return false };
+ const newOrder = {...currentOrder};
+ newOrder[ingredient].push(value);
+ setCurrentOrder(newOrder);
+ }
+
+ const handleOrderLimited = (ingredient) => {
+ const newLimit = {...orderLimited};
+ if (currentOrder[ingredient].length === orderLimited[ingredient].amount) {
+ console.log("limited: ", currentOrder[ingredient].length, orderLimited[ingredient].amount);
+ newLimit[ingredient].limited = true;
+ setOrderLimited(newLimit);
+ return true;
+ }
+ // console.log("not limited:", currentOrder[ingredient].length, orderLimited[ingredient].amount);
+ return false;
+ }
+
+ const handleDisplay = (toHide, toShow) => {
+ // Used to toggle the display of vegetables & sauces
+ const canDisplay = {...orderDisplay};
+ canDisplay[toHide] = false;
+ canDisplay[toShow] = true;
+ setOrderDisplay(canDisplay);
+ }
+
+ return (
+
+
+ {console.log(currentOrder)}
+ {console.log(orderLimited)}
+
+ {/* Choose Bread */}
+
+
+
+ Choisissez le pain
+
+
+
+ {defaultBreads.map((bread) => (
+
handleOnSelected('bread', bread.name, {hide:'bread', show:'meat'})}>
+
+
+ ))}
+
+
+
+ {/* Choose Meat */}
+
+
+
+ Passons à la viande... ou au tofu ?
+
+
+
+ {defaultMeats.map((meat) => (
+
handleOnSelected('meat', meat.name, {hide:'meat', show:'vegetables'})}>
+
+
+ ))}
+
+
handleDisplay('meat', 'bread')}>
+
+
+
+
+ {/* Choose Vegetables */}
+
+
+ Des crudités pour votre merveille ?
+
+
+
+ {defaultVegetables.map((veg) => (
+
handleOnAdded('vegetables', veg.name)}>
+ handleOrderLimited('vegetables')} />
+
+ ))}
+
+
handleDisplay('vegetables', 'meat')}>
+
+
+
+
handleDisplay('vegetables', 'sauces')}>
+
+
+
+
+ {/* Choose Sauces */}
+
+
+ Des sauces pour donner de la couleur à cette magie ?
+
+
+
+ {defaultSauces.map((veg) => (
+
+
+
+ ))}
+
+
+
+
+
+ );
+};
+
+export default App;
diff --git a/src/Order.jsx b/src/Order.jsx
new file mode 100644
index 0000000..3356ebf
--- /dev/null
+++ b/src/Order.jsx
@@ -0,0 +1,131 @@
+// import { useState } from "react";
+// import * as Data from "./data";
+// // import { BrowserRouter, Route, NavLink, Switch } from "react-router-dom";
+
+// export function OrderForm(props) {
+// const ingredients = {
+// sauces: [...Data.defaultBreads],
+// meats: [...Data.defaultMeats],
+// vegetables: [...Data.defaultVegetables],
+// sauces: [...Data.defaultSauces],
+// };
+
+// const [selectedProducts, setSelectedProducts] = useState(
+// ...Data.defaultOrder
+// );
+
+// const [bread, setBread] = useState("");
+// const [meat, setMeat] = useState("");
+// const [vegetables, setVegetables] = useState("");
+// const [sauces, setSauces] = useState("");
+
+// // const [checkedState, setCheckedState] = useState(
+// // new Array(ingredients.length).fill(false)
+// // );
+
+// const { onSubmit } = props;
+
+// // const handleOnChange = (position) => {
+// // const updatedCheckedState = checkedState.map((item, index) =>
+// // index === position ? true : item
+// // );
+
+// const handleOnSelected = (productSelected) => {
+// const updatedSelectedProducts = selectedProducts.map((initialProduct) =>
+// initialProduct === productSelected.name ? productSelected = productSelected.value : false
+// );
+
+// setSelectedProducts(updatedSelectedProducts);
+
+// // setCheckedState(updatedCheckedState);
+// // const Finishedsauces = updatedCheckedState.reduce(
+// // (sauce, currentState, index) => {
+// // if (currentState === false) {
+// // switch (ingredients.vegetables) {
+// // case "salade":
+// // setSalade("");
+// // break;
+// // case "tomate":
+// // setTomate("");
+// // break;
+// // case "oignon":
+// // setOignon("");
+// // break;
+// // default:
+// // console.log("aucun changement");
+// // }
+// // }
+// // if (currentState === true) {
+// // switch (ingredients[index].categorie) {
+// // case "pains":
+// // setPain(ingredients[index].name);
+// // break;
+// // case "viandes":
+// // setViande(ingredients[index].name);
+// // break;
+// // case "salade":
+// // setSalade(ingredients[index].name);
+// // break;
+// // case "tomate":
+// // setTomate(ingredients[index].name);
+// // break;
+// // case "oignon":
+// // setOignon(ingredients[index].name);
+// // break;
+// // case "sauces":
+// // if (sauce.length < 2) {
+// // setSauces((sauce = [...sauce, " " + ingredients[index].name]));
+// // }
+// // return sauce;
+// // default:
+// // console.log("aucun changement");
+// // }
+// // return sauce;
+// // }
+// // return sauce;
+// // },
+// // );
+
+// setSauces(Finishedsauces);
+// };
+
+// const handleSubmit = (event) => {
+// event.preventDefault();
+// onSubmit({ pain, viande, salade, tomate, oignon, sauces });
+// };
+
+// return (
+//
+//
+//
+//
Total:
+//
{sauces}
+//
+//
+//
+// );
+// }
+// export default OrderForm;
diff --git a/src/logo.svg b/src/assets/logo.svg
similarity index 100%
rename from src/logo.svg
rename to src/assets/logo.svg
diff --git a/src/assets/logo_colored.png b/src/assets/logo_colored.png
new file mode 100644
index 0000000..6d43091
Binary files /dev/null and b/src/assets/logo_colored.png differ
diff --git a/src/components/Button.jsx b/src/components/Button.jsx
new file mode 100644
index 0000000..9431a37
--- /dev/null
+++ b/src/components/Button.jsx
@@ -0,0 +1,34 @@
+import * as React from "react";
+
+import "../index.css";
+
+export const buttonClassNames = [
+ "px-4",
+ "py-2",
+ "transition",
+ "duration-500",
+ "ease-in-out",
+ "transform",
+ "border-2",
+ "rounded-md",
+ "border-opacity-40",
+ "hover:bg-opacity-80",
+ "hover:-translate-y-1",
+ "hover:scale-110",
+ "hover:border-opacity-100",
+];
+
+export class Button extends React.Component {
+ // constructor(props) {
+ // super(props);
+ // };
+
+ render() {
+ const { text } = this.props;
+ return (
+
+ );
+ }
+}
diff --git a/src/components/IngredientBox.jsx b/src/components/IngredientBox.jsx
new file mode 100644
index 0000000..e137329
--- /dev/null
+++ b/src/components/IngredientBox.jsx
@@ -0,0 +1,22 @@
+import * as React from "react";
+
+import "../index.css";
+import { buttonClassNames } from "./Button";
+
+export class IngredientBox extends React.Component {
+ render() {
+ const { name, image, onSelected, isDisabled } = this.props;
+ const className = [
+ ...buttonClassNames,
+ onSelected ? "border-green-500" : "border-red-1000",
+ isDisabled ? "cursor-not-allowed" : "cursor-pointer"
+ ];
+
+ return (
+
+
{name}
+
+
+ );
+ }
+}
diff --git a/src/components/Navbar.jsx b/src/components/Navbar.jsx
new file mode 100644
index 0000000..7d05259
--- /dev/null
+++ b/src/components/Navbar.jsx
@@ -0,0 +1,14 @@
+import * as React from "react";
+
+import "../index.css";
+import logo_colored from "../assets/logo_colored.png";
+
+export class Navbar extends React.Component {
+ render() {
+ return (
+
+
+
+ );
+ }
+}
diff --git a/src/components/exemple.js b/src/components/exemple.js
deleted file mode 100644
index e69de29..0000000
diff --git a/src/data.jsx b/src/data.jsx
new file mode 100644
index 0000000..7f3ae01
--- /dev/null
+++ b/src/data.jsx
@@ -0,0 +1,31 @@
+export const defaultOrder = {
+ bread: null,
+ meat: null,
+ vegetables: [],
+ sauces: [],
+};
+
+export const defaultBreads = [
+ { name: "Pain", image: "https://gcdn.pbrd.co/images/CHPZLamyCwSs.png" },
+ { name: "Galette", image: "https://gcdn.pbrd.co/images/AE1S51pHMKtD.png" },
+];
+
+export const defaultMeats = [
+ { name: "Viande", image: "https://gcdn.pbrd.co/images/kqzD645lDkpD.png" },
+ { name: "Tofu", image: "https://gcdn.pbrd.co/images/jPtID3NgkUwg.png" },
+];
+
+export const defaultVegetables = [
+ { name: "Salade", image: "https://gcdn.pbrd.co/images/KRs543S4d5X1.png" },
+ { name: "Tomates", image: "https://gcdn.pbrd.co/images/zh9glozsF6PW.png" },
+ { name: "Oignons", image: "https://gcdn.pbrd.co/images/K0EmdkUPOtYv.png" },
+];
+
+export const defaultSauces = [
+ { name: "Blanche", image: "https://gcdn.pbrd.co/images/CHPZLamyCwSs.png" },
+ { name: "Harissa", image: "https://gcdn.pbrd.co/images/AE1S51pHMKtD.png" },
+ { name: "Andalouse", image: "https://gcdn.pbrd.co/images/CHPZLamyCwSs.png" },
+ { name: "Barbecue", image: "https://gcdn.pbrd.co/images/AE1S51pHMKtD.png" },
+ { name: "Ketchup", image: "https://gcdn.pbrd.co/images/CHPZLamyCwSs.png" },
+ { name: "Curry", image: "https://gcdn.pbrd.co/images/AE1S51pHMKtD.png" },
+];
diff --git a/src/App.css b/src/index.css
similarity index 98%
rename from src/App.css
rename to src/index.css
index 1f088a0..d4b4e80 100644
--- a/src/App.css
+++ b/src/index.css
@@ -16,7 +16,7 @@ code {
monospace;
}
-.App {
+/* .App {
text-align: center;
}
@@ -53,4 +53,4 @@ code {
to {
transform: rotate(360deg);
}
-}
+} */
diff --git a/src/views/ChooseBread.jsx b/src/views/ChooseBread.jsx
new file mode 100644
index 0000000..cec86a0
--- /dev/null
+++ b/src/views/ChooseBread.jsx
@@ -0,0 +1,34 @@
+import * as React from "react";
+
+import "../index.css";
+
+import { IngredientBox } from "../components/IngredientBox";
+import { OrderSummary } from "./OrderSummary";
+import { Button } from "../components/Button";
+import { defaultBreads } from "../data";
+
+// import { selectedProducts } from "../Order";
+
+export function ChooseBread(props) {
+
+ return (
+
+
+ Choisissez le pain
+
+
+ {defaultBreads.map((bread) => (
+
+
+
+ ))}
+
+
+
+
+
+ );
+ }
diff --git a/src/views/ChooseMeat.jsx b/src/views/ChooseMeat.jsx
new file mode 100644
index 0000000..bedbee4
--- /dev/null
+++ b/src/views/ChooseMeat.jsx
@@ -0,0 +1,34 @@
+import * as React from "react";
+// import { BrowserRouter, Route, NavLink, Switch } from "react-router-dom";
+
+import "../index.css";
+
+import { IngredientBox } from "../components/IngredientBox";
+import { meat, setMeat } from "../Order";
+import { Button } from "../components/Button";
+
+import { defaultMeats } from "../data";
+
+export function ChooseMeat(props) {
+ return (
+
+
+ Passons à la viande... ou au tofu ?
+
+
+ {defaultMeats.map((meat) => (
+
+ ))}
+
+
+
+
+
+ );
+}
diff --git a/src/views/ChooseSauces.jsx b/src/views/ChooseSauces.jsx
new file mode 100644
index 0000000..8bea8b6
--- /dev/null
+++ b/src/views/ChooseSauces.jsx
@@ -0,0 +1,35 @@
+import * as React from "react";
+
+import "../index.css";
+import { Button, buttonClassNames } from "../components/Button";
+import { IngredientBox } from "../components/IngredientBox";
+
+// import { selectedProducts, setSelectedProducts } from "../Order";
+// import { sauces, setSauces } from "../Order";
+
+import { defaultSauces } from "../data";
+
+export function ChooseSauces(props) {
+
+ return (
+
+
+
+ Des sauces pour donner de la couleur à cette magie ?
+
+
+
+ {defaultSauces.map((s) => (
+
+
+
+ ))}
+
+
+
Choisir sans sauce
+
+
+
+
+ );
+}
diff --git a/src/views/ChooseVegetables.jsx b/src/views/ChooseVegetables.jsx
new file mode 100644
index 0000000..5c26017
--- /dev/null
+++ b/src/views/ChooseVegetables.jsx
@@ -0,0 +1,35 @@
+import * as React from "react";
+
+import "../index.css";
+import { buttonClassNames } from "../components/Button";
+
+import { IngredientBox } from "../components/IngredientBox";
+import { Button } from "../components/Button";
+
+import { defaultVegetables } from "../data";
+
+export function ChooseVegetables(props) {
+ const classNames = [
+ ...buttonClassNames,
+ "border-red-1000",
+ "my-5",
+ "font-semibold",
+ ];
+
+ return (
+
+
+ Des crudités pour votre merveille ?
+
+
+ {defaultVegetables.map((veg) => (
+
+ ))}
+
+
Je continue sans crudités
+
+
+
+
+ );
+}
diff --git a/src/views/OrderSummary.jsx b/src/views/OrderSummary.jsx
new file mode 100644
index 0000000..02597fa
--- /dev/null
+++ b/src/views/OrderSummary.jsx
@@ -0,0 +1,21 @@
+import * as React from "react";
+
+import "../index.css";
+
+import { Button } from "../components/Button";
+
+export function OrderSummary(props) {
+ return (
+
+
+ Récapitulons votre commande...
+
+
+ {this.state.currentOrder.bread}
+
+
+
+
+
+ );
+}
diff --git a/tailwind.config.js b/tailwind.config.js
index ace2b1f..c16c4cc 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -2,13 +2,19 @@ module.exports = {
purge: ["./src/**/*.{js,jsx,ts,tsx}", "./public/index.html"],
darkMode: false, // or 'media' or 'class'
theme: {
- colors: {
- 'yellowbright': '#FFF6D6',
+ extend: {
+ colors: {
+ yellow: {
+ 25: "#FFF6D6",
+ },
+ red: {
+ 1000: "#4d0302",
+ },
+ },
},
- extend: {},
- },
- variants: {
- extend: {},
+ variants: {
+ extend: {},
+ },
+ plugins: [],
},
- plugins: [],
};