File size: 1,556 Bytes
f5071ca |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
import { Box, Heading, Text, useColorModeValue } from '@chakra-ui/react';
import React from 'react';
import { useNavigate } from 'react-router-dom';
import { titleRoute } from '../../helper/titleRoute';
import ManangePost from './ManangePost';
const DraftPostItem = ({ username, title, postId }) => {
const navigate = useNavigate();
const handleNavigate = () => {
navigate(`/${titleRoute(username, title, postId)}`);
};
return (
<Box
bg={useColorModeValue('light.cardBg', 'dark.cardBg')}
className='shadow'
borderRadius={{ base: '0', md: '5px' }}
p={{ base: '.5rem', sm: '1rem' }}
cursor='pointer'
mb='.5rem'
onClick={handleNavigate}
>
<Text
bg='#FBBF24'
color='dark.cardColor'
px='5px'
fontSize='13px'
borderRadius='5px'
display='inline-block'
>
Draft
</Text>
<Heading
cursor='pointer'
mt={2}
w='100%'
_hover={{
color: useColorModeValue(
'light.headingHover',
'dark.headingHover'
),
}}
fontSize={['1.2rem', '1.5rem']}
onClick={handleNavigate}
>
{title}
</Heading>
<Box w='100%' display='flex' justifyContent='flex-end'>
<ManangePost postId={postId} m='0 0 0 auto' />
</Box>
</Box>
);
};
export default DraftPostItem;
|