mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-09-02 22:02:39 +02:00
Add email to download PDF functionality
This commit is contained in:
@@ -8,17 +8,63 @@ import {
|
|||||||
Container,
|
Container,
|
||||||
Flex,
|
Flex,
|
||||||
Heading,
|
Heading,
|
||||||
|
Input,
|
||||||
Link,
|
Link,
|
||||||
|
Modal,
|
||||||
|
ModalBody,
|
||||||
|
ModalCloseButton,
|
||||||
|
ModalContent,
|
||||||
|
ModalOverlay,
|
||||||
Stack,
|
Stack,
|
||||||
Text,
|
Text,
|
||||||
|
useDisclosure
|
||||||
} from '@chakra-ui/react';
|
} from '@chakra-ui/react';
|
||||||
import { ChatIcon, AtSignIcon, DownloadIcon } from '@chakra-ui/icons';
|
import { AtSignIcon, ChatIcon, DownloadIcon } from '@chakra-ui/icons';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { SIGNUP_EMAIL_INPUT_NAME, SIGNUP_FORM_ACTION } from '../../pages/signup';
|
||||||
|
|
||||||
type RoadmapPageHeaderType = {
|
type RoadmapPageHeaderType = {
|
||||||
roadmap: RoadmapType;
|
roadmap: RoadmapType;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function RoadmapDownloader() {
|
||||||
|
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||||
|
const initialRef = React.useRef(null);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Button
|
||||||
|
onClick={onOpen}
|
||||||
|
size='xs'
|
||||||
|
py='14px'
|
||||||
|
px='10px'
|
||||||
|
leftIcon={<DownloadIcon />}
|
||||||
|
display={['none', 'flex']}
|
||||||
|
colorScheme='yellow'
|
||||||
|
variant='solid'
|
||||||
|
_hover={{ textDecoration: 'none' }}
|
||||||
|
>
|
||||||
|
Download
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Modal initialFocusRef={initialRef} closeOnOverlayClick={true} isOpen={isOpen} onClose={onClose} isCentered>
|
||||||
|
<ModalOverlay />
|
||||||
|
<ModalContent>
|
||||||
|
<ModalCloseButton />
|
||||||
|
<ModalBody p={6}>
|
||||||
|
<Heading mb='5px' fontSize='2xl'>Download Roadmap</Heading>
|
||||||
|
<Text fontSize={'md'} color='gray.700'>Enter your email below to receive the download link.</Text>
|
||||||
|
<form action={SIGNUP_FORM_ACTION} method='post' target='_blank' onSubmit={onClose}>
|
||||||
|
<Input required ref={initialRef} size='md' my='10px' type='email' placeholder='Email address' name={SIGNUP_EMAIL_INPUT_NAME} />
|
||||||
|
<Button type='submit' colorScheme='green' size='md' width={'full'}>Send Link</Button>
|
||||||
|
</form>
|
||||||
|
</ModalBody>
|
||||||
|
</ModalContent>
|
||||||
|
</Modal>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export function RoadmapPageHeader(props: RoadmapPageHeaderType) {
|
export function RoadmapPageHeader(props: RoadmapPageHeaderType) {
|
||||||
const { roadmap } = props;
|
const { roadmap } = props;
|
||||||
|
|
||||||
@@ -27,13 +73,13 @@ export function RoadmapPageHeader(props: RoadmapPageHeaderType) {
|
|||||||
pt={['25px', '20px', '45px']}
|
pt={['25px', '20px', '45px']}
|
||||||
pb={['20px', '15px', '30px']}
|
pb={['20px', '15px', '30px']}
|
||||||
borderBottomWidth={1}
|
borderBottomWidth={1}
|
||||||
mb="30px"
|
mb='30px'
|
||||||
>
|
>
|
||||||
<Container maxW="container.md" position="relative">
|
<Container maxW='container.md' position='relative'>
|
||||||
<NewAlertBanner />
|
<NewAlertBanner />
|
||||||
<Heading
|
<Heading
|
||||||
as="h1"
|
as='h1'
|
||||||
color="black"
|
color='black'
|
||||||
fontSize={['28px', '33px', '40px']}
|
fontSize={['28px', '33px', '40px']}
|
||||||
fontWeight={700}
|
fontWeight={700}
|
||||||
mb={['2px', '2px', '5px']}
|
mb={['2px', '2px', '5px']}
|
||||||
@@ -41,50 +87,35 @@ export function RoadmapPageHeader(props: RoadmapPageHeaderType) {
|
|||||||
{roadmap.title}
|
{roadmap.title}
|
||||||
</Heading>
|
</Heading>
|
||||||
<Text fontSize={['13px', '14px', '15px']}>{roadmap.description}</Text>
|
<Text fontSize={['13px', '14px', '15px']}>{roadmap.description}</Text>
|
||||||
<Flex justifyContent="space-between" alignItems={'center'} mt="20px">
|
<Flex justifyContent='space-between' alignItems={'center'} mt='20px'>
|
||||||
<Stack isInline flex={1}>
|
<Stack isInline flex={1}>
|
||||||
<Button
|
<Button
|
||||||
d={['flex', 'flex']}
|
d={['flex', 'flex']}
|
||||||
as={Link}
|
as={Link}
|
||||||
href={'/roadmaps'}
|
href={'/roadmaps'}
|
||||||
size="xs"
|
size='xs'
|
||||||
py="14px"
|
py='14px'
|
||||||
px="10px"
|
px='10px'
|
||||||
colorScheme="teal"
|
colorScheme='teal'
|
||||||
variant="solid"
|
variant='solid'
|
||||||
_hover={{ textDecoration: 'none' }}
|
_hover={{ textDecoration: 'none' }}
|
||||||
>
|
>
|
||||||
←
|
←
|
||||||
<Text as="span" d={['none', 'inline']} ml="5px">
|
<Text as='span' d={['none', 'inline']} ml='5px'>
|
||||||
All Roadmaps
|
All Roadmaps
|
||||||
</Text>
|
</Text>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
{roadmap.pdfUrl && (
|
<RoadmapDownloader />
|
||||||
<Button
|
|
||||||
as={Link}
|
|
||||||
href={roadmap.pdfUrl}
|
|
||||||
target="_blank"
|
|
||||||
size="xs"
|
|
||||||
py="14px"
|
|
||||||
px="10px"
|
|
||||||
leftIcon={<DownloadIcon />}
|
|
||||||
d={['none', 'flex']}
|
|
||||||
colorScheme="yellow"
|
|
||||||
variant="solid"
|
|
||||||
_hover={{ textDecoration: 'none' }}
|
|
||||||
>
|
|
||||||
Download
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
<Button
|
<Button
|
||||||
as={Link}
|
as={Link}
|
||||||
href={'/signup'}
|
href={'/signup'}
|
||||||
size="xs"
|
size='xs'
|
||||||
py="14px"
|
py='14px'
|
||||||
px="10px"
|
px='10px'
|
||||||
variant="solid"
|
variant='solid'
|
||||||
colorScheme="yellow"
|
colorScheme='yellow'
|
||||||
leftIcon={<AtSignIcon />}
|
leftIcon={<AtSignIcon />}
|
||||||
_hover={{ textDecoration: 'none' }}
|
_hover={{ textDecoration: 'none' }}
|
||||||
>
|
>
|
||||||
@@ -95,10 +126,10 @@ export function RoadmapPageHeader(props: RoadmapPageHeaderType) {
|
|||||||
as={Link}
|
as={Link}
|
||||||
href={`${siteConfig.url.issue}?title=[Suggestion] ${roadmap.title}`}
|
href={`${siteConfig.url.issue}?title=[Suggestion] ${roadmap.title}`}
|
||||||
target='_blank'
|
target='_blank'
|
||||||
size="xs"
|
size='xs'
|
||||||
py="14px"
|
py='14px'
|
||||||
px="10px"
|
px='10px'
|
||||||
colorScheme="green"
|
colorScheme='green'
|
||||||
leftIcon={<ChatIcon />}
|
leftIcon={<ChatIcon />}
|
||||||
_hover={{ textDecoration: 'none' }}
|
_hover={{ textDecoration: 'none' }}
|
||||||
>
|
>
|
||||||
@@ -109,16 +140,16 @@ export function RoadmapPageHeader(props: RoadmapPageHeaderType) {
|
|||||||
</Flex>
|
</Flex>
|
||||||
{isInteractiveRoadmap(roadmap.id) && (
|
{isInteractiveRoadmap(roadmap.id) && (
|
||||||
<Text
|
<Text
|
||||||
mt="30px"
|
mt='30px'
|
||||||
mb={['-37px', '-32px', '-47px']}
|
mb={['-37px', '-32px', '-47px']}
|
||||||
fontWeight={500}
|
fontWeight={500}
|
||||||
fontSize="14px"
|
fontSize='14px'
|
||||||
bg="white"
|
bg='white'
|
||||||
borderWidth={1}
|
borderWidth={1}
|
||||||
p="5px 7px"
|
p='5px 7px'
|
||||||
rounded="3px"
|
rounded='3px'
|
||||||
>
|
>
|
||||||
<Badge pos="relative" top={'-1px'} mr="6px" colorScheme="yellow">
|
<Badge pos='relative' top={'-1px'} mr='6px' colorScheme='yellow'>
|
||||||
New
|
New
|
||||||
</Badge>
|
</Badge>
|
||||||
Resources are here, try clicking any nodes.
|
Resources are here, try clicking any nodes.
|
||||||
|
Reference in New Issue
Block a user