-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5ae8114
commit 552dfd4
Showing
12 changed files
with
440 additions
and
62 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { useEffect, useState } from 'react'; | ||
import PastPaper from './PastPaper'; | ||
import { HStack, useToast, Text, Flex, Stack, Button, useDisclosure } from '@chakra-ui/react'; | ||
import { CloseIcon, InfoIcon } from '@chakra-ui/icons'; | ||
import OneTap from '../OneTap'; | ||
import { BiLeftArrow, BiRightArrow, BiRightArrowAlt } from 'react-icons/bi'; | ||
import { ROUTING } from '~/lib/constant'; | ||
import Link from 'next/link'; | ||
import { useRouter } from 'next/router'; | ||
|
||
export default function PastPaperToast() { | ||
const toast = useToast(); | ||
const [show, setShow] = useState<boolean>(true); | ||
const router = useRouter(); | ||
const toastId = 'past-paper-toast'; | ||
|
||
useEffect(() => { | ||
if (router.pathname === ROUTING.past_papers || !show) return; | ||
setShow(false); | ||
|
||
toast({ | ||
id: toastId, | ||
title: '📃 Past Papers', | ||
description: 'View Past Papers', | ||
duration: 1000 * 30, | ||
position: 'bottom-right', | ||
size: 'sm', | ||
colorScheme: 'gray', | ||
render: () => { | ||
return ( | ||
<Flex | ||
bg={'var(--bg-color)'} | ||
border={'2px solid var(--card-color-dark)'} | ||
p={2} | ||
rounded={'md'}> | ||
<HStack w={'full'}> | ||
<Button | ||
size={'sm'} | ||
variant={'ghost'} | ||
onClick={() => { | ||
toast.close(toastId); | ||
}}> | ||
<CloseIcon fontSize={'sm'} /> | ||
</Button> | ||
<Stack w={'full'} spacing={1}> | ||
<HStack> | ||
<InfoIcon /> | ||
<Text>📃 Past Papers</Text> | ||
</HStack> | ||
<HStack> | ||
<Text fontSize={'sm'}>Browse Past Papers</Text> | ||
</HStack> | ||
</Stack> | ||
<Link href={ROUTING.past_papers}> | ||
<Button ml={'auto'} size={'sm'}> | ||
<BiRightArrowAlt /> | ||
</Button> | ||
</Link> | ||
</HStack> | ||
</Flex> | ||
); | ||
}, | ||
isClosable: true | ||
}); | ||
}); | ||
return <></>; | ||
} |
Oops, something went wrong.