import React, { useMemo } from 'react'; import { Box, Flex } from '@chakra-ui/react'; import type { GridProps } from '@chakra-ui/react'; import MyIcon from '@fastgpt/web/components/common/Icon'; import type { IconNameType } from '@fastgpt/web/components/common/Icon/type.d'; // @ts-ignore export interface Props extends GridProps { list: { id: string; label: string; icon: string }[]; activeId: string; size?: 'sm' | 'md' | 'lg'; onChange: (id: string) => void; } const SideTabs = ({ list, size = 'md', activeId, onChange, ...props }: Props) => { const sizeMap = useMemo(() => { switch (size) { case 'sm': return { fontSize: 'sm', inlineP: 1 }; case 'md': return { fontSize: 'md', inlineP: 2 }; case 'lg': return { fontSize: 'lg', inlineP: 3 }; } }, [size]); return ( {list.map((item) => ( { if (activeId === item.id) return; onChange(item.id); }} > {item.label} ))} ); }; export default React.memo(SideTabs);