From 04b466d7ba983966df3cd69ac9cdad19002657f8 Mon Sep 17 00:00:00 2001 From: Maximus Date: Mon, 15 Aug 2022 15:28:47 +0300 Subject: [PATCH] closed issue #65 added modal bottomsheet bar --- src/components/AcceptCookies.tsx | 41 +++++++++++++ src/components/BottomSheetBar.tsx | 58 +++++++++++++++++++ .../modal/BottomBarAcceptCookies.tsx | 17 ++++++ .../containers/modal/BottomSheetModal.tsx | 33 +++++++++++ 4 files changed, 149 insertions(+) create mode 100644 src/components/AcceptCookies.tsx create mode 100644 src/components/BottomSheetBar.tsx create mode 100644 src/components/containers/modal/BottomBarAcceptCookies.tsx create mode 100644 src/components/containers/modal/BottomSheetModal.tsx diff --git a/src/components/AcceptCookies.tsx b/src/components/AcceptCookies.tsx new file mode 100644 index 0000000..b2fc1dd --- /dev/null +++ b/src/components/AcceptCookies.tsx @@ -0,0 +1,41 @@ +import React from "react"; +import { Button } from "./Button/Button"; +import Typography from "./typography/Typography"; + +type AcceptCookiesProps = { + onClickAccept?: () => void; + onClickCustomise?: () => void; +}; + +export function AcceptCookies({ + onClickAccept, + onClickCustomise, +}: AcceptCookiesProps) { + return ( +
+
+ + By clicking “Accept All Cookies”, you agree to the storing of cookies + on your device to enhance site navigation, analyze site usage, and + assist in our marketing efforts. + +
+
+ + +
+
+ ); +} diff --git a/src/components/BottomSheetBar.tsx b/src/components/BottomSheetBar.tsx new file mode 100644 index 0000000..6e25743 --- /dev/null +++ b/src/components/BottomSheetBar.tsx @@ -0,0 +1,58 @@ +import { useState } from "react"; +import { Dialog } from "@headlessui/react"; +import { Button } from "./Button/Button"; +import Typography from "components/typography/Typography"; + +export function BottomSheetBar() { + // The open/closed state lives outside of the Dialog and is managed by you + let [isOpen, setIsOpen] = useState(true); + + function handleDeactivate() { + alert("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); + } + + return ( + /* + Pass `isOpen` to the `open` prop, and use `onClose` to set + the state back to `false` when the user clicks outside of + the dialog or presses the escape key. + */ + {}} + className="absolute bottom-0 bg-blue-900 text-white w-full" + > + + + By clicking “Accept All Cookies”, you agree to the storing of cookies + on your device to enhance site navigation, analyze site usage, and + assist in our marketing efforts. + + {/* + You can render additional buttons to dismiss your dialog by setting + `isOpen` to `false`. + */} +
+ + +
+
+
+ ); +} diff --git a/src/components/containers/modal/BottomBarAcceptCookies.tsx b/src/components/containers/modal/BottomBarAcceptCookies.tsx new file mode 100644 index 0000000..886ab5a --- /dev/null +++ b/src/components/containers/modal/BottomBarAcceptCookies.tsx @@ -0,0 +1,17 @@ +import { AcceptCookies } from "components/AcceptCookies"; +import { BottomSheetModal } from "components/containers/modal/BottomSheetModal"; +import { useState } from "react"; + +export function BottomBarAcceptCookies() { + let [isShowing, setIsShowing] = useState(true); + + function closeModal() { + setIsShowing(false); + } + + return ( + + + + ); +} diff --git a/src/components/containers/modal/BottomSheetModal.tsx b/src/components/containers/modal/BottomSheetModal.tsx new file mode 100644 index 0000000..6ac7ef5 --- /dev/null +++ b/src/components/containers/modal/BottomSheetModal.tsx @@ -0,0 +1,33 @@ +import React, { Fragment, useState } from "react"; +import { Dialog, Transition } from "@headlessui/react"; +import { AcceptCookies } from "components/AcceptCookies"; + +type ButtonSheetBarProps = { + isShowing: boolean; + onClose: () => void; + children?: React.ReactNode; +} & Omit, "">; + +export function BottomSheetModal({ + isShowing, + onClose, + children, +}: ButtonSheetBarProps) { + return ( + + {}}> + {children} + + + ); +}