Refactor guides page
This commit is contained in:
30
pages/guides/components/guide-grid-item.tsx
Normal file
30
pages/guides/components/guide-grid-item.tsx
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import { Badge, Box, Heading, Link, Text } from '@chakra-ui/react';
|
||||||
|
|
||||||
|
type GuideGridItemProps = {
|
||||||
|
title: string;
|
||||||
|
subtitle: string;
|
||||||
|
date: string;
|
||||||
|
isNew?: boolean;
|
||||||
|
colorIndex?: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
const bgColorList = [
|
||||||
|
'gray.700',
|
||||||
|
'purple.800'
|
||||||
|
];
|
||||||
|
|
||||||
|
export function GuideGridItem(props: GuideGridItemProps) {
|
||||||
|
const { title, subtitle, date, isNew = false, colorIndex = 0 } = props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Link _hover={{ textDecoration: 'none', transform: 'scale(1.02)' }} as={Box} href='#' shadow='xl' p='20px'
|
||||||
|
rounded='10px' bg={bgColorList[colorIndex] ?? bgColorList[0]} flex={1}>
|
||||||
|
<Text mb='10px' fontSize='13px' color='gray.400'>
|
||||||
|
{isNew && <Badge colorScheme={'yellow'} mr='10px'>New</Badge>}
|
||||||
|
{date}
|
||||||
|
</Text>
|
||||||
|
<Heading color='white' mb={'6px'} fontSize='20px'>{title}</Heading>
|
||||||
|
<Text color='gray.300' fontSize='14px'>{subtitle}</Text>
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
}
|
@ -5,6 +5,7 @@ import { LinksListItem } from '../../components/links-list-item';
|
|||||||
import { OpensourceBanner } from '../../components/opensource-banner';
|
import { OpensourceBanner } from '../../components/opensource-banner';
|
||||||
import { UpdatesBanner } from '../../components/updates-banner';
|
import { UpdatesBanner } from '../../components/updates-banner';
|
||||||
import { Footer } from '../../components/footer';
|
import { Footer } from '../../components/footer';
|
||||||
|
import { GuideGridItem } from './components/guide-grid-item';
|
||||||
|
|
||||||
export default function Guides() {
|
export default function Guides() {
|
||||||
return (
|
return (
|
||||||
@ -17,28 +18,22 @@ export default function Guides() {
|
|||||||
<Text fontSize='15px'>Succinct graphical explanations to development related topics.</Text>
|
<Text fontSize='15px'>Succinct graphical explanations to development related topics.</Text>
|
||||||
</Container>
|
</Container>
|
||||||
</Box>
|
</Box>
|
||||||
<Container maxW='container.md' position='relative'>
|
<Container maxW='container.md' position='relative' mt='30px'>
|
||||||
<Badge mt='40px' mb='10px' variant='solid' colorScheme='green'>Recent Guides</Badge>
|
|
||||||
{/*<Text mt='40px' mb='10px' fontWeight={700} color='green.500'>Recent Guides</Text>*/}
|
|
||||||
{/*<Heading mt='40px' mb='15px' color='green.500' fontSize='20px'>Recent Guides</Heading>*/}
|
|
||||||
<Stack isInline mb='30px' spacing='15px'>
|
<Stack isInline mb='30px' spacing='15px'>
|
||||||
<Link _hover={{ textDecoration: 'none', transform: 'scale(1.02)' }} as={Box} href='#' shadow='xl' p='20px' py='25px' rounded='10px' bg={'gray.700'} flex={1}>
|
<GuideGridItem
|
||||||
<Text mb='10px' fontSize='13px' color='gray.400'>June 25, 2021</Text>
|
title='Session Based Authentication'
|
||||||
<Heading color='white' mb={'6px'} fontSize='22px'>Session Based Authentication</Heading>
|
subtitle='Learn what the Session Based Authentication is, the pros and cons.'
|
||||||
<Text color='gray.300' fontSize='14px'>Learn what the Session Based Authentication is, the pros and cons
|
date='June 25, 2021'
|
||||||
.</Text>
|
isNew
|
||||||
</Link>
|
/>
|
||||||
|
<GuideGridItem
|
||||||
<Link _hover={{ textDecoration: 'none', transform: 'scale(1.02)' }} as={Box} href='#' shadow='xl' p='20px' py='25px' rounded='10px' bg={'purple.800'} flex={1}>
|
title='JSON Web Tokens'
|
||||||
<Text mb='10px' fontSize='13px' color='gray.400'>June 25, 2021</Text>
|
subtitle='Learn what the Session Based Authentication is, the pros and cons and how you can implement it in your apps.'
|
||||||
<Heading color='white' mb={'6px'} fontSize='22px'>JSON Web Tokens</Heading>
|
date='June 25, 2021'
|
||||||
<Text color='gray.300' fontSize='14px'>Learn what the Session Based Authentication is, the pros and cons
|
colorIndex={1}
|
||||||
and how you can implement it in your
|
/>
|
||||||
apps.</Text>
|
|
||||||
</Link>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
<Badge mt='30px' mb='10px' variant='solid' colorScheme='green'>Past Guides</Badge>
|
|
||||||
<LinksList>
|
<LinksList>
|
||||||
<LinksListItem title='Session based Authentication' badgeText='pro' subtitle='June 12, 2021' />
|
<LinksListItem title='Session based Authentication' badgeText='pro' subtitle='June 12, 2021' />
|
||||||
<LinksListItem title='Session based Authentication' subtitle='June 12, 2021' />
|
<LinksListItem title='Session based Authentication' subtitle='June 12, 2021' />
|
||||||
|
Reference in New Issue
Block a user