Added stickers to modal.

This commit is contained in:
Lucid Kobold
2022-01-07 10:55:32 -06:00
parent dd1945a4ef
commit 934cd98e3c
2 changed files with 60 additions and 8 deletions

View File

@@ -7,10 +7,13 @@ import {
ModalCloseButton, ModalCloseButton,
ModalBody, ModalBody,
ModalFooter, ModalFooter,
Heading Heading,
HStack,
VStack
} from "@chakra-ui/react"; } from "@chakra-ui/react";
import React, { Fragment } from "react"; import React, { Fragment, useState } from "react";
import { format } from "date-fns"; import { format } from "date-fns";
import DemoStickers from "../stickers/DemoStickers";
interface AddStickerProps { interface AddStickerProps {
isOpen: boolean; isOpen: boolean;
@@ -40,6 +43,8 @@ const AddSticker = ({
* Show a message when a date before the current date is selected. * Show a message when a date before the current date is selected.
*/ */
const [selectedSticker, setSelectedSticker] = useState<StickerVal>(null);
return ( return (
<Fragment> <Fragment>
<Modal <Modal
@@ -48,17 +53,52 @@ const AddSticker = ({
onClose={() => updateIsOpen(!isOpen)} onClose={() => updateIsOpen(!isOpen)}
motionPreset="slideInBottom" motionPreset="slideInBottom"
scrollBehavior="inside" scrollBehavior="inside"
size="lg"
> >
<ModalOverlay /> <ModalOverlay />
<ModalContent> <ModalContent>
<ModalHeader> <ModalHeader>
<Heading textAlign="center" as="h2" size="md" w="100%"> <Heading textAlign="center" as="h2" size="md" w="100%" h="auto">
{format(date, "LLLL do, y")} {`Which sticker did you earn for ${format(date, "LLL d, y")}?`}
</Heading> </Heading>
</ModalHeader> </ModalHeader>
<ModalCloseButton /> <ModalCloseButton />
<ModalBody></ModalBody> <ModalBody>
<VStack>
<HStack
w="100%"
h="auto"
justifyContent="center"
alignContent="center"
spacing={6}
>
<Button
border={selectedSticker === 1 ? "1px solid #FFF" : "opx"}
bg={selectedSticker === 1 && "gray.800"}
onClick={() => setSelectedSticker(1)}
variant="stickerButton"
>
<DemoStickers stickerVal={1} />
</Button>
<Button
border={selectedSticker === 0 ? "1px solid #FFF" : "opx"}
bg={selectedSticker === 0 && "gray.800"}
onClick={() => setSelectedSticker(0)}
variant="stickerButton"
>
<DemoStickers stickerVal={0} />
</Button>
<Button
border={selectedSticker === -1 ? "1px solid #FFF" : "opx"}
bg={selectedSticker === -1 && "gray.800"}
onClick={() => setSelectedSticker(-1)}
variant="stickerButton"
>
<DemoStickers stickerVal={-1} />
</Button>
</HStack>
</VStack>
</ModalBody>
<ModalFooter> <ModalFooter>
<Button <Button
colorScheme="blue" colorScheme="blue"

View File

@@ -14,7 +14,7 @@ const buttonStyles = {
sizes: {}, sizes: {},
// styles for different visual variants ("outline", "solid") // styles for different visual variants ("outline", "solid")
variants: { variants: {
contactPrimary: (props: Dict<never> | StyleFunctionProps) => ({ primary: (props: Dict<never> | StyleFunctionProps) => ({
bg: "rgba(255, 255, 255, .15)", bg: "rgba(255, 255, 255, .15)",
fontSize: "xl", fontSize: "xl",
p: "2", p: "2",
@@ -25,7 +25,7 @@ const buttonStyles = {
)(props) )(props)
} }
}), }),
contactSecondary: (props: Dict<never> | StyleFunctionProps) => ({ secondary: (props: Dict<never> | StyleFunctionProps) => ({
bg: "brand.primary", bg: "brand.primary",
fontSize: "xl", fontSize: "xl",
p: "2", p: "2",
@@ -36,6 +36,18 @@ const buttonStyles = {
)(props) )(props)
} }
}), }),
stickerButton: (props: Dict<never> | StyleFunctionProps) => ({
bg: "transparent",
fontSize: "4rem",
px: 2,
py: 14,
_hover: {
bg: mode(
whiten("brand.secondary", 20),
darken("brand.secondary", 20)
)(props)
}
}),
project: (props: Dict<never> | StyleFunctionProps) => ({ project: (props: Dict<never> | StyleFunctionProps) => ({
bg: "transparent", bg: "transparent",
fontSize: "md", fontSize: "md",