generated from the-collab-lab/smart-shopping-list
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from the-collab-lab/yj-ky-list-item-chakra
Adds Chakra UI To List and ListItem Components
- Loading branch information
Showing
4 changed files
with
284 additions
and
108 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { useRef } from 'react'; | ||
import { | ||
AlertDialog, | ||
AlertDialogBody, | ||
AlertDialogFooter, | ||
AlertDialogHeader, | ||
AlertDialogContent, | ||
AlertDialogOverlay, | ||
Button, | ||
Heading, | ||
} from '@chakra-ui/react'; | ||
|
||
export function Dialog({ isOpen, onClose, handleDelete, name }) { | ||
const cancelRef = useRef(); | ||
|
||
return ( | ||
<AlertDialog isOpen={isOpen} leastDestructiveRef={cancelRef}> | ||
<AlertDialogOverlay> | ||
<AlertDialogContent bg="notSoon.500"> | ||
<AlertDialogHeader> | ||
<Heading fontSize="xl">Delete Item</Heading> | ||
</AlertDialogHeader> | ||
<AlertDialogBody> | ||
Are you sure you want to delete {name}? | ||
</AlertDialogBody> | ||
<AlertDialogFooter> | ||
<Button | ||
onClick={onClose} | ||
color="brand.500" | ||
bg="text.500" | ||
_hover={{ | ||
background: 'approaching.500', | ||
color: 'text.500', | ||
}} | ||
> | ||
<p>Cancel</p> | ||
</Button> | ||
<Button | ||
color="text.500" | ||
bg="overdue.500" | ||
_hover={{ | ||
background: 'approaching.500', | ||
color: 'text.500', | ||
}} | ||
onClick={() => { | ||
handleDelete(); | ||
onClose(); | ||
}} | ||
ml={3} | ||
> | ||
Delete | ||
</Button> | ||
</AlertDialogFooter> | ||
</AlertDialogContent> | ||
</AlertDialogOverlay> | ||
</AlertDialog> | ||
); | ||
} |
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.