-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add components and types needed for cart
- Loading branch information
Showing
8 changed files
with
105 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Flex, Spinner, Text } from "@chakra-ui/react"; | ||
|
||
export type LoadingScreenProps = { | ||
minH?: string; | ||
text: string; | ||
}; | ||
|
||
export const LoadingScreen = ({ minH = "50vh", text = "" }: LoadingScreenProps) => { | ||
return ( | ||
<Flex | ||
minH={minH} | ||
alignItems="center" | ||
justifyContent="center" | ||
flexDirection="column" | ||
gap={8} | ||
> | ||
<Spinner thickness="4px" speed="0.65s" size="xl" /> | ||
<Text>{text}</Text> | ||
</Flex> | ||
); | ||
}; |
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,17 @@ | ||
import { ReactNode } from "react"; | ||
import { Flex, FlexProps, Text, Divider } from "@chakra-ui/react"; | ||
|
||
type CartCardProps = FlexProps & { | ||
title?: string; | ||
children: ReactNode; | ||
}; | ||
|
||
export const CartCard = ({ children, title, ...props }: CartCardProps) => { | ||
return ( | ||
<Flex px={3} py={4} gap={4} flexDir="column" borderWidth="1px" borderRadius="lg" {...props}> | ||
<Text fontWeight={600}>{title} </Text> | ||
<Divider /> | ||
{children} | ||
</Flex> | ||
); | ||
}; |
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,17 @@ | ||
import React from "react"; | ||
import Link from 'next/link'; | ||
import { Center, Flex, Heading, Button } from "@chakra-ui/react"; | ||
import { routes } from "web/features/merch/constants"; | ||
|
||
export const CartEmptyView: React.FC = () => ( | ||
<Center minH="50vh" width="100%"> | ||
<Flex flexDirection="column" gap={8} alignItems="center"> | ||
<Heading fontSize="2xl">No items in your cart</Heading> | ||
<Link href={routes.HOME}> | ||
<Button size="md" flexShrink={1} borderRadius={0}> | ||
CONTINUE SHOPPING | ||
</Button> | ||
</Link> | ||
</Flex> | ||
</Center> | ||
); |
File renamed without changes.
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,40 @@ | ||
import React from "react"; | ||
|
||
import { Button, Divider, Modal, ModalOverlay, ModalContent, ModalFooter, ModalBody, Text } from "@chakra-ui/react"; | ||
|
||
type CartRemoveModalType = { | ||
isOpen: boolean; | ||
onClose: () => void; | ||
removeItem: () => void; | ||
}; | ||
|
||
export const CartRemoveModal: React.FC<CartRemoveModalType> = (props) => { | ||
const { isOpen, onClose, removeItem } = props; | ||
return ( | ||
<Modal isOpen={isOpen} onClose={onClose} isCentered trapFocus={false}> | ||
<ModalOverlay /> | ||
<ModalContent> | ||
<ModalBody px="4" py={8} textAlign="center"> | ||
<Text fontSize="md">Do you want to remove this product?</Text> | ||
</ModalBody> | ||
<Divider /> | ||
<ModalFooter justifyContent="center" p={0}> | ||
<Button | ||
onClick={onClose} | ||
border={0} | ||
flexGrow={1} | ||
borderRadius={0} | ||
variant="outline" | ||
colorScheme="blackAlpha" | ||
borderRight="1px solid #E2E8F0" | ||
> | ||
No | ||
</Button> | ||
<Button border={0} borderRadius={0} flexGrow={1} variant="outline" onClick={() => removeItem()}> | ||
Yes | ||
</Button> | ||
</ModalFooter> | ||
</ModalContent> | ||
</Modal> | ||
); | ||
}; |
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,4 @@ | ||
export * from "./CartCard" | ||
export * from "./CartHeader" | ||
export * from "./CartEmptyView" | ||
export * from "./CartRemoveModal" |
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