File size: 1,098 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 |
import React from 'react';
import { HStack, Image, Text, useColorModeValue } from '@chakra-ui/react';
import IconBadge from './IconBadge';
const SideMenuItem = ({ isActive, icon, title, onClick, savedPostsCount }) => {
const bgColor = useColorModeValue('light.secondary', 'dark.secondary');
const color = useColorModeValue('light.linkColor', 'dark.linkColor');
const activeColor = useColorModeValue(
'light.headingHover',
'dark.headingHover'
);
return (
<HStack
cursor='pointer'
p='.5rem'
borderRadius='5px'
_hover={{
bg: useColorModeValue('light.secondary', 'dark.secondary'),
color: useColorModeValue('light.headingHover', 'dark.headingHover'),
}}
onClick={onClick}
bg={isActive && bgColor}
color={isActive ? activeColor : color}
mb={1}
>
{icon && <Image src={icon} alt='menu_icon' />}
<Text>{title}</Text>
{savedPostsCount && <IconBadge value={savedPostsCount} />}
</HStack>
);
};
export default SideMenuItem;
|