From 601999a6bbeb08c71d8908bacc0bade7413d900d Mon Sep 17 00:00:00 2001 From: Nakonkate Tintapura Date: Sun, 16 Jul 2023 23:08:33 +0700 Subject: [PATCH] Feature/rkm66 55 invite modal logic (#52) * feat: add modal ui component * refactor: prepare modal ui set for implementation * chore: minor changes * chore: purple color * chore: typo --------- Co-authored-by: shalluv --- package.json | 1 + pnpm-lock.yaml | 15 ++++ src/components/Modal.tsx | 87 +++++++++++++++++++ src/components/Navbar.tsx | 2 +- .../BaanSelection/components/BaanPanel.tsx | 8 +- .../BaanSelection/components/GroupPanel.tsx | 6 +- .../BaanSelection/components/InviteLink.tsx | 2 +- .../components/ProfileInfoPanel.tsx | 2 +- src/components/Profile/WaitForBaan/index.tsx | 2 +- src/components/baan-selection/ListBaan.tsx | 2 +- src/components/baan-selection/SearchBar.tsx | 2 +- .../baan-selection/SelectedBaan.tsx | 6 +- src/context/ModalContext.tsx | 49 +++++++++++ src/pages/_app.tsx | 14 +-- src/pages/baan-selection/index.tsx | 4 +- src/pages/faq.tsx | 2 +- src/pages/privacy-policy.tsx | 2 +- src/pages/register.tsx | 6 +- src/pages/terms-conditions.tsx | 2 +- src/pages/wait-baan-selection.tsx | 2 +- tailwind.config.js | 6 +- 21 files changed, 191 insertions(+), 31 deletions(-) create mode 100644 src/components/Modal.tsx create mode 100644 src/context/ModalContext.tsx diff --git a/package.json b/package.json index 0f7284b..b1bc9f8 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "prepare": "husky install" }, "dependencies": { + "@headlessui/react": "1.7.15", "@heroicons/react": "2.0.18", "autoprefixer": "10.4.14", "axios": "1.4.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 472ac18..977124a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,6 +5,9 @@ settings: excludeLinksFromLockfile: false dependencies: + '@headlessui/react': + specifier: 1.7.15 + version: 1.7.15(react-dom@18.2.0)(react@18.2.0) '@heroicons/react': specifier: 2.0.18 version: 2.0.18(react@18.2.0) @@ -347,6 +350,18 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true + /@headlessui/react@1.7.15(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-OTO0XtoRQ6JPB1cKNFYBZv2Q0JMqMGNhYP1CjPvcJvjz8YGokz8oAj89HIYZGN0gZzn/4kk9iUpmMF4Q21Gsqw==} + engines: {node: '>=10'} + peerDependencies: + react: ^16 || ^17 || ^18 + react-dom: ^16 || ^17 || ^18 + dependencies: + client-only: 0.0.1 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + dev: false + /@heroicons/react@2.0.18(react@18.2.0): resolution: {integrity: sha512-7TyMjRrZZMBPa+/5Y8lN0iyvUU/01PeMGX2+RE7cQWpEUIcb4QotzUObFkJDejj/HUH4qjP/eQ0gzzKs2f+6Yw==} peerDependencies: diff --git a/src/components/Modal.tsx b/src/components/Modal.tsx new file mode 100644 index 0000000..be29c24 --- /dev/null +++ b/src/components/Modal.tsx @@ -0,0 +1,87 @@ +import { Dialog, Transition } from '@headlessui/react'; +import { Fragment, ReactNode } from 'react'; + +export interface ModalProps { + open: boolean; + onClose: () => any; + children?: ReactNode; + answer1?: string; + answer2?: string; +} + +export const Modal = ({ + open, + onClose, + children, + answer1, + answer2, +}: ModalProps) => { + return ( + <> + + + +
+ + +
+
+ + +
+
+
+ {children} +
+
+
+
+ + +
+
+
+
+
+
+
+ + ); +}; diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 7cd9a0f..3a85958 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -7,7 +7,7 @@ function Navbar() { const { user, logout, login } = useAuth(); return ( -