diff --git a/apps/frontend-bff/src/main.tsx b/apps/frontend-bff/src/main.tsx index 563fabf..da4e45b 100644 --- a/apps/frontend-bff/src/main.tsx +++ b/apps/frontend-bff/src/main.tsx @@ -3,6 +3,7 @@ import * as ReactDOM from 'react-dom/client'; import { BrowserRouter } from 'react-router-dom'; import App from './app/app'; +import {CssBaseline} from "@mui/material"; const root = ReactDOM.createRoot( document.getElementById('root') as HTMLElement @@ -10,6 +11,7 @@ const root = ReactDOM.createRoot( root.render( + diff --git a/libs/ui/common/src/index.ts b/libs/ui/common/src/index.ts index feea622..4c98658 100644 --- a/libs/ui/common/src/index.ts +++ b/libs/ui/common/src/index.ts @@ -1,5 +1,6 @@ export * from './lib/ui-common'; export * from './lib/tables/landingPage'; +export * from './lib/tables/tableSquare'; export * from './lib/offers/offers'; export * from './lib/orders/orders'; export * from './lib/summary/summary'; diff --git a/libs/ui/common/src/lib/tables/landingPage.css b/libs/ui/common/src/lib/tables/landingPage.css deleted file mode 100644 index 0ca2a2f..0000000 --- a/libs/ui/common/src/lib/tables/landingPage.css +++ /dev/null @@ -1,23 +0,0 @@ -.title { - font-family: 'Montserrat', sans-serif; - font-weight: 900; /* You can change to 400 for regular weight */ -} - -.plus-minus-select { - font-family: 'Montserrat', sans-serif; - font-weight: 900; - font-size: 100px; -} - -.table-box { - width: 20vw; - height: 20vw; /* Padding around the container */ -} -.table-button { - height: 68%; -} - -.horizontal-container { - width: 100%; - display: flex; /* Enables flexbox */ - } \ No newline at end of file diff --git a/libs/ui/common/src/lib/tables/landingPage.tsx b/libs/ui/common/src/lib/tables/landingPage.tsx index fa40d7d..787a7a4 100644 --- a/libs/ui/common/src/lib/tables/landingPage.tsx +++ b/libs/ui/common/src/lib/tables/landingPage.tsx @@ -1,51 +1,41 @@ -import { CenterFocusStrong } from '@mui/icons-material'; -import './landingPage.css'; -import { useNavigate } from "react-router-dom"; +import {useNavigate} from "react-router-dom"; import TableSquare from './tableSquare'; -import { Button, Typography, Grid2, Box } from "@mui/material"; +import {Button, Typography, Box, Grid2 as Grid} from "@mui/material"; import * as React from 'react'; -import { useState } from 'react'; -import { Router } from 'react-router-dom'; +import {useState} from 'react'; export function LandingPage() { - const [totalPeople, setTotalPeople] = useState(0); - const navigate = useNavigate(); + const [totalPeople, setTotalPeople] = useState(0); + const navigate = useNavigate(); - const validateTables = () => { - console.log({totalPeople}) - navigate("/offers") - } + const validateTables = () => { + console.log({totalPeople}) + navigate("/offers") + } - return ( - - - Tables - - - {Array.from(Array(9)).map((_, index) => ( - - - - ))} - - - { totalPeople>0 ? - - : null - } - - - ); + return ( + + + Tables + + + {Array.from(Array(15)).map((_, index) => ( + + + + ))} + + + + + + ); } -export default LandingPage; \ No newline at end of file + +export default LandingPage; diff --git a/libs/ui/common/src/lib/tables/nbPeopleSelector.tsx b/libs/ui/common/src/lib/tables/nbPeopleSelector.tsx index 7af7f95..e5fd8b6 100644 --- a/libs/ui/common/src/lib/tables/nbPeopleSelector.tsx +++ b/libs/ui/common/src/lib/tables/nbPeopleSelector.tsx @@ -1,11 +1,149 @@ -import './landingPage.css'; +import {ReactNode, useState} from 'react'; +import * as React from 'react'; +import { + Unstable_NumberInput as BaseNumberInput, + NumberInputProps, +} from '@mui/base/Unstable_NumberInput'; +import { styled } from '@mui/system'; +import RemoveIcon from '@mui/icons-material/Remove'; import AddIcon from '@mui/icons-material/Add'; -import RemoveRoundedIcon from '@mui/icons-material/RemoveRounded'; -import { IconButton, Typography, Box } from "@mui/material"; -import { useState } from 'react'; +const NumberInput = React.forwardRef(function CustomNumberInput( + props: NumberInputProps, + ref: React.ForwardedRef, +) { + return ( + , + className: 'increment', + }, + decrementButton: { + children: , + }, + }} + {...props } + ref={ref} + /> + ); +}); +const blue = { + 100: '#daecff', + 200: '#b6daff', + 300: '#66b2ff', + 400: '#3399ff', + 500: '#007fff', + 600: '#0072e5', + 700: '#0059B2', + 800: '#004c99', +}; + +const grey = { + 50: '#F3F6F9', + 100: '#E5EAF2', + 200: '#DAE2ED', + 300: '#C7D0DD', + 400: '#B0B8C4', + 500: '#9DA8B7', + 600: '#6B7A90', + 700: '#434D5B', + 800: '#303740', + 900: '#1C2025', +}; + +const StyledInputRoot = styled('div')( + ({ theme }) => ` + font-family: 'IBM Plex Sans', sans-serif; + font-weight: 400; + color: ${theme.palette.mode === 'dark' ? grey[300] : grey[500]}; + display: flex; + flex-flow: row nowrap; + justify-content: center; + align-items: center; +`, +); + +const StyledInput = styled('input')( + ({ theme }) => ` + font-size: 0.875rem; + font-family: inherit; + font-weight: 400; + line-height: 1.375; + color: ${theme.palette.mode === 'dark' ? grey[300] : grey[900]}; + background: ${theme.palette.mode === 'dark' ? grey[900] : '#fff'}; + border: 1px solid ${theme.palette.mode === 'dark' ? grey[700] : grey[200]}; + box-shadow: 0px 2px 4px ${ + theme.palette.mode === 'dark' ? 'rgba(0,0,0, 0.5)' : 'rgba(0,0,0, 0.05)' + }; + border-radius: 8px; + margin: 0 8px; + padding: 10px 12px; + outline: 0; + min-width: 0; + width: 4rem; + text-align: center; + + &:hover { + border-color: ${blue[400]}; + } + + &:focus { + border-color: ${blue[400]}; + box-shadow: 0 0 0 3px ${theme.palette.mode === 'dark' ? blue[700] : blue[200]}; + } + + &:focus-visible { + outline: 0; + } +`, +); + +const StyledButton = styled('button')( + ({ theme }) => ` + font-family: 'IBM Plex Sans', sans-serif; + font-size: 0.875rem; + box-sizing: border-box; + line-height: 1.5; + border: 1px solid; + border-radius: 999px; + border-color: ${theme.palette.mode === 'dark' ? grey[800] : grey[200]}; + background: ${theme.palette.mode === 'dark' ? grey[900] : grey[50]}; + color: ${theme.palette.mode === 'dark' ? grey[200] : grey[900]}; + width: 32px; + height: 32px; + display: flex; + flex-flow: row nowrap; + justify-content: center; + align-items: center; + transition-property: all; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + transition-duration: 120ms; + + &:hover { + cursor: pointer; + background: ${theme.palette.mode === 'dark' ? blue[700] : blue[500]}; + border-color: ${theme.palette.mode === 'dark' ? blue[500] : blue[400]}; + color: ${grey[50]}; + } + + &:focus-visible { + outline: 0; + } + + &.increment { + order: 1; + } +`, +); export function NbPeopleSelector({totalPeople, setTotalPeople}) { const [nbPeople, setNbPeople] = useState(0) @@ -24,18 +162,8 @@ export function NbPeopleSelector({totalPeople, setTotalPeople}) { }; return ( - - - - - - {nbPeople} - - - - - + ); } -export default NbPeopleSelector; \ No newline at end of file +export default NbPeopleSelector; diff --git a/libs/ui/common/src/lib/tables/tableSquare.tsx b/libs/ui/common/src/lib/tables/tableSquare.tsx index 9e3af3b..c95084c 100644 --- a/libs/ui/common/src/lib/tables/tableSquare.tsx +++ b/libs/ui/common/src/lib/tables/tableSquare.tsx @@ -1,9 +1,9 @@ -import './landingPage.css'; import NbPeopleSelector from './nbPeopleSelector'; import { purple, red } from '@mui/material/colors'; import { Button, Typography, Box } from "@mui/material"; import {useState} from 'react'; +import {styled} from "@mui/system"; export function TableSquare({tableNumber, totalPeople, setTotalPeople}) { const [showPeopleSelector, setShowPeopleSelector] = useState(false) @@ -12,18 +12,31 @@ export function TableSquare({tableNumber, totalPeople, setTotalPeople}) { } return ( - - - { showPeopleSelector ? : null } + { showPeopleSelector ? : <> } - + ); } -export default TableSquare; \ No newline at end of file +export default TableSquare; diff --git a/package-lock.json b/package-lock.json index da895db..3061908 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "dependencies": { "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", + "@mui/base": "^5.0.0-beta.58", "@mui/icons-material": "^6.1.0", "@mui/material": "^6.1.0", "@nestjs/common": "^10.0.2", @@ -23,7 +24,8 @@ "reflect-metadata": "^0.1.13", "rxjs": "^7.8.0", "tailwind": "^4.0.0", - "tslib": "^2.3.0" + "tslib": "^2.3.0", + "zustand": "^5.0.0-rc.2" }, "devDependencies": { "@babel/core": "^7.14.5", @@ -3959,6 +3961,44 @@ "node": ">=14" } }, + "node_modules/@floating-ui/core": { + "version": "1.6.8", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.6.8.tgz", + "integrity": "sha512-7XJ9cPU+yI2QeLS+FCSlqNFZJq8arvswefkZrYI1yQBbftw6FyrZOxYSh+9S7z7TpeWlRt9zJ5IhM1WIL334jA==", + "license": "MIT", + "dependencies": { + "@floating-ui/utils": "^0.2.8" + } + }, + "node_modules/@floating-ui/dom": { + "version": "1.6.11", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.6.11.tgz", + "integrity": "sha512-qkMCxSR24v2vGkhYDo/UzxfJN3D4syqSjyuTFz6C7XcpU1pASPRieNI0Kj5VP3/503mOfYiGY891ugBX1GlABQ==", + "license": "MIT", + "dependencies": { + "@floating-ui/core": "^1.6.0", + "@floating-ui/utils": "^0.2.8" + } + }, + "node_modules/@floating-ui/react-dom": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.1.2.tgz", + "integrity": "sha512-06okr5cgPzMNBy+Ycse2A6udMi4bqwW/zgBF/rwjcNqWkyr82Mcg8b0vjX8OJpZFy/FKjJmw6wV7t44kK6kW7A==", + "license": "MIT", + "dependencies": { + "@floating-ui/dom": "^1.0.0" + }, + "peerDependencies": { + "react": ">=16.8.0", + "react-dom": ">=16.8.0" + } + }, + "node_modules/@floating-ui/utils": { + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.8.tgz", + "integrity": "sha512-kym7SodPp8/wloecOpcmSnWJsK7M0E5Wg8UcFA+uO4B9s5d0ywXOEro/8HM9x0rW+TljRzul/14UYz3TleT3ig==", + "license": "MIT" + }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.14", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", @@ -4994,6 +5034,68 @@ "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } }, + "node_modules/@mui/base": { + "version": "5.0.0-beta.58", + "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-beta.58.tgz", + "integrity": "sha512-P0E7ZrxOuyYqBvVv9w8k7wm+Xzx/KRu+BGgFcR2htTsGCpJNQJCSUXNUZ50MUmSU9hzqhwbQWNXhV1MBTl6F7A==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.25.0", + "@floating-ui/react-dom": "^2.1.1", + "@mui/types": "^7.2.15", + "@mui/utils": "6.0.0-rc.0", + "@popperjs/core": "^2.11.8", + "clsx": "^2.1.1", + "prop-types": "^15.8.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mui-org" + }, + "peerDependencies": { + "@types/react": "^17.0.0 || ^18.0.0", + "react": "^17.0.0 || ^18.0.0", + "react-dom": "^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@mui/base/node_modules/@mui/utils": { + "version": "6.0.0-rc.0", + "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-6.0.0-rc.0.tgz", + "integrity": "sha512-tBp0ILEXDL0bbDDT8PnZOjCqSm5Dfk2N0Z45uzRw+wVl6fVvloC9zw8avl+OdX1Bg3ubs/ttKn8nRNv17bpM5A==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.25.0", + "@mui/types": "^7.2.15", + "@types/prop-types": "^15.7.12", + "clsx": "^2.1.1", + "prop-types": "^15.8.1", + "react-is": "^18.3.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mui-org" + }, + "peerDependencies": { + "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", + "react": "^17.0.0 || ^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/@mui/core-downloads-tracker": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-6.1.0.tgz", @@ -26437,6 +26539,35 @@ "engines": { "node": "^12.20.0 || >=14" } + }, + "node_modules/zustand": { + "version": "5.0.0-rc.2", + "resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.0-rc.2.tgz", + "integrity": "sha512-o2Nwuvnk8vQBX7CcHL8WfFkZNJdxB/VKeWw0tNglw8p4cypsZ3tRT7rTRTDNeUPFS0qaMBRSKe+fVwL5xpcE3A==", + "license": "MIT", + "engines": { + "node": ">=12.20.0" + }, + "peerDependencies": { + "@types/react": ">=18.0.0", + "immer": ">=9.0.6", + "react": ">=18.0.0", + "use-sync-external-store": ">=1.2.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "immer": { + "optional": true + }, + "react": { + "optional": true + }, + "use-sync-external-store": { + "optional": true + } + } } } } diff --git a/package.json b/package.json index 8e01a4f..b11e40d 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "dependencies": { "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", + "@mui/base": "^5.0.0-beta.58", "@mui/icons-material": "^6.1.0", "@mui/material": "^6.1.0", "@nestjs/common": "^10.0.2", @@ -21,7 +22,8 @@ "reflect-metadata": "^0.1.13", "rxjs": "^7.8.0", "tailwind": "^4.0.0", - "tslib": "^2.3.0" + "tslib": "^2.3.0", + "zustand": "^5.0.0-rc.2" }, "devDependencies": { "@babel/core": "^7.14.5",