closed issue #65 added modal bottomsheet bar
This commit is contained in:
parent
2913a3368a
commit
04b466d7ba
41
src/components/AcceptCookies.tsx
Normal file
41
src/components/AcceptCookies.tsx
Normal file
@ -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 (
|
||||||
|
<div className="px-12 py-4 w-full bg-blue-900 flex justify-between items-center">
|
||||||
|
<div className="w-2/3 text-white pr-3">
|
||||||
|
<Typography>
|
||||||
|
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.
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
<div className="flex w-1/3 flex-col-reverse lg:flex-row items-center lg:space-x-5 lg:justify-end ">
|
||||||
|
<Button
|
||||||
|
onClick={onClickCustomise}
|
||||||
|
defaultStyle={false}
|
||||||
|
className="bg-tranparent hover:bg-blue-200 active:bg-blue-400 focus:bg-none focus:outline-none text-blue-700"
|
||||||
|
>
|
||||||
|
Customize settings
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
onClick={onClickAccept}
|
||||||
|
emphasis="high"
|
||||||
|
className="focus:outline-none"
|
||||||
|
>
|
||||||
|
Accept all cookies
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
58
src/components/BottomSheetBar.tsx
Normal file
58
src/components/BottomSheetBar.tsx
Normal file
@ -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.
|
||||||
|
*/
|
||||||
|
<Dialog
|
||||||
|
open={isOpen}
|
||||||
|
onClose={() => {}}
|
||||||
|
className="absolute bottom-0 bg-blue-900 text-white w-full"
|
||||||
|
>
|
||||||
|
<Dialog.Panel className="flex px-[47px] py-6 justify-between items-center">
|
||||||
|
<Dialog.Description className="items-center">
|
||||||
|
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.
|
||||||
|
</Dialog.Description>
|
||||||
|
{/*
|
||||||
|
You can render additional buttons to dismiss your dialog by setting
|
||||||
|
`isOpen` to `false`.
|
||||||
|
*/}
|
||||||
|
<div className="flex flex-col md:flex-row">
|
||||||
|
<Button
|
||||||
|
defaultStyle={false}
|
||||||
|
emphasis="low"
|
||||||
|
className=" items-center grow-0 min-h-max mx-3 text-blue-600 hover:bg-blue-200 focus:outline-none active:bg-blue-400"
|
||||||
|
onClick={handleDeactivate}
|
||||||
|
>
|
||||||
|
<Typography fontWeightVariant="semibold">
|
||||||
|
Customize settings
|
||||||
|
</Typography>
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
className="md:w-max min-h-max mx-3 focus:outline-none items-center"
|
||||||
|
onClick={() => setIsOpen(false)}
|
||||||
|
>
|
||||||
|
<Typography fontWeightVariant="semibold">
|
||||||
|
Accept all cookies
|
||||||
|
</Typography>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</Dialog.Panel>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
}
|
17
src/components/containers/modal/BottomBarAcceptCookies.tsx
Normal file
17
src/components/containers/modal/BottomBarAcceptCookies.tsx
Normal file
@ -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 (
|
||||||
|
<BottomSheetModal onClose={closeModal} isShowing={isShowing}>
|
||||||
|
<AcceptCookies onClickAccept={closeModal} />
|
||||||
|
</BottomSheetModal>
|
||||||
|
);
|
||||||
|
}
|
33
src/components/containers/modal/BottomSheetModal.tsx
Normal file
33
src/components/containers/modal/BottomSheetModal.tsx
Normal file
@ -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<React.ComponentPropsWithoutRef<"div">, "">;
|
||||||
|
|
||||||
|
export function BottomSheetModal({
|
||||||
|
isShowing,
|
||||||
|
onClose,
|
||||||
|
children,
|
||||||
|
}: ButtonSheetBarProps) {
|
||||||
|
return (
|
||||||
|
<Transition
|
||||||
|
appear
|
||||||
|
show={isShowing}
|
||||||
|
as={Fragment}
|
||||||
|
enter="ease-in-out duration-200"
|
||||||
|
enterFrom="translate-y-full"
|
||||||
|
enterTo="translate-y-0"
|
||||||
|
leave="ease-out duration-300"
|
||||||
|
leaveFrom="translate-y-0 opacity-100"
|
||||||
|
leaveTo="translate-y-full opacity-0"
|
||||||
|
>
|
||||||
|
<Dialog className="fixed bottom-0" as="div" onClose={() => {}}>
|
||||||
|
{children}
|
||||||
|
</Dialog>
|
||||||
|
</Transition>
|
||||||
|
);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user