92 lines
2.4 KiB
TypeScript

import { ReactElement } from 'react';
import { Center, Flex, Text, Wrap, WrapItem } from '@chakra-ui/react';
import { LuCrown, LuDisc3, LuEar, LuFileAudio, LuUser } from 'react-icons/lu';
import { useNavigate } from 'react-router-dom';
import { PageLayout } from '@/components/Layout/PageLayout';
import { TopBar } from '@/components/TopBar/TopBar';
import { DataTools, TypeCheck } from '@/utils/data-tools';
import { useThemeMode } from '@/utils/theme-tools';
type HelpListType = {
id: number;
name: string;
icon: ReactElement;
to: string;
};
const helpList: HelpListType[] = [
{
id: 1,
name: 'plouf',
icon: <LuCrown size="60%" height="full" />,
to: 'gender',
},
];
export const HelpPage = () => {
const { mode } = useThemeMode();
const navigate = useNavigate();
const onSelectItem = (data: HelpListType) => {
navigate(data.to);
};
const testData = [
{
name: 'lkjlkj',
},
];
const result = DataTools.getsWhere(
testData,
[
{
check: TypeCheck.STARTS_WITH,
key: 'name',
value: ['ll', 'k'],
},
],
['track', 'name']
);
console.log(`startsWith : ${JSON.stringify(result, null, 2)}`);
return (
<>
<TopBar title="Help" />
<PageLayout>
<Wrap spacing="20px" marginX="auto" padding="20px" justify="center">
{helpList.map((data) => (
<WrapItem
width="200px"
height="190px"
border="1px"
borderColor="brand.900"
backgroundColor={mode('#FFFFFF88', '#00000088')}
key={data.id}
padding="5px"
as="button"
_hover={{
boxShadow: 'outline-over',
bgColor: mode('#FFFFFFF7', '#000000F7'),
}}
onClick={() => onSelectItem(data)}
>
<Flex direction="column" width="full" height="full">
<Center height="full">{data.icon}</Center>
<Center>
<Text
fontSize="25px"
fontWeight="bold"
textTransform="uppercase"
userSelect="none"
>
{data.name}
</Text>
</Center>
</Flex>
</WrapItem>
))}
</Wrap>
</PageLayout>
</>
);
};