-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds initial boilerplate for supporting dark mode
- Loading branch information
1 parent
3fadd44
commit de7ca00
Showing
20 changed files
with
965 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
129 changes: 129 additions & 0 deletions
129
packages/builder/components/pages/index/survey/get-started.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
import { | ||
Button, | ||
Flex, | ||
Grid, | ||
Heading, | ||
Modal, | ||
ModalBody, | ||
ModalCloseButton, | ||
ModalContent, | ||
ModalHeader, | ||
ModalOverlay, | ||
Text, | ||
useColorModeValue, | ||
useDisclosure, | ||
VStack, | ||
} from "@chakra-ui/react"; | ||
import darkModeSiteData from "data/site/dark"; | ||
import lightModeSiteData from "data/site/light"; | ||
import React, { FC } from "react"; | ||
import { MdArrowForward } from "react-icons/md"; | ||
import { useDispatch } from "react-redux"; | ||
import { setSiteData } from "slices/site"; | ||
|
||
const GetStarted: FC = () => { | ||
const dispatch = useDispatch(); | ||
const bgColor = useColorModeValue("brand.100", "brand.900"); | ||
const { isOpen, onOpen, onClose } = useDisclosure(); | ||
|
||
const mapTemplateIdToData = (templateId: string) => { | ||
switch (templateId) { | ||
case "dark": | ||
return darkModeSiteData; | ||
|
||
case "light": | ||
return lightModeSiteData; | ||
|
||
default: | ||
return lightModeSiteData; | ||
} | ||
}; | ||
|
||
const handleSiteTemplateSelection = (templateId: string) => { | ||
const siteData = mapTemplateIdToData(templateId); | ||
|
||
dispatch(setSiteData(siteData)); | ||
}; | ||
|
||
const templateNode = () => { | ||
const templates = [ | ||
{ | ||
id: "dark", | ||
label: "Dark", | ||
bgColor: "gray.900", | ||
color: "white", | ||
}, | ||
{ | ||
id: "light", | ||
label: "Light", | ||
bgColor: "gray.100", | ||
color: "black", | ||
}, | ||
]; | ||
|
||
return templates.map((template) => { | ||
return ( | ||
<Flex | ||
key={template.id} | ||
as="button" | ||
onClick={() => handleSiteTemplateSelection(template.id)} | ||
justifyContent="center" | ||
alignItems="center" | ||
bg={template.bgColor} | ||
color={template.color} | ||
borderWidth={1} | ||
rounded="lg" | ||
p={8} | ||
_hover={{ | ||
shadow: "lg", | ||
}} | ||
> | ||
<Text>{template.label}</Text> | ||
</Flex> | ||
); | ||
}); | ||
}; | ||
|
||
const modalNode = () => { | ||
return ( | ||
<Modal isOpen={isOpen} onClose={onClose} isCentered size="xl"> | ||
<ModalOverlay /> | ||
<ModalContent bg={bgColor}> | ||
<ModalHeader /> | ||
<ModalCloseButton /> | ||
<ModalBody> | ||
<VStack alignItems="flex-start"> | ||
<Heading | ||
fontSize="4xl" | ||
bgGradient="linear(to-l, #7928CA,#FF0080)" | ||
bgClip="text" | ||
> | ||
Get started | ||
</Heading> | ||
<Text>Click to select your preferred template to continue.</Text> | ||
<Grid templateColumns="repeat(2, 1fr)" gap={8} w="100%" py={8}> | ||
{templateNode()} | ||
</Grid> | ||
</VStack> | ||
</ModalBody> | ||
</ModalContent> | ||
</Modal> | ||
); | ||
}; | ||
|
||
return ( | ||
<> | ||
<Button | ||
onClick={onOpen} | ||
colorScheme="blue" | ||
size="lg" | ||
rightIcon={<MdArrowForward />} | ||
> | ||
Get started | ||
</Button> | ||
{modalNode()} | ||
</> | ||
); | ||
}; | ||
|
||
export default GetStarted; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.