Files
FastGPT/packages/web/components/common/Tabs/FillRowTabs.tsx
Archer 26d800981c 4.8.10 test (#2433)
* perf: node template ui

* perf: select tool path load error

* pay i18n

* i18n

* perf: oneapi code

* perf: doc

* node templates

* perf: usage table role

* feat: count vector total by datasetId

* perf: user select tip and tempalte market ui

* i18n

* perf: sso config tip
2024-08-20 18:31:40 +08:00

60 lines
1.4 KiB
TypeScript

import React from 'react';
import { Flex, Box, BoxProps } from '@chakra-ui/react';
import MyIcon from '../Icon';
type Props = Omit<BoxProps, 'onChange'> & {
list: {
icon?: string;
label: string | React.ReactNode;
value: string;
}[];
value: string;
onChange: (e: string) => void;
};
const FillRowTabs = ({ list, value, onChange, py = '7px', px = '12px', ...props }: Props) => {
return (
<Box
display={'inline-flex'}
px={'3px'}
py={'3px'}
borderRadius={'md'}
borderWidth={'1px'}
borderColor={'borderColor.base'}
bg={'myGray.50'}
gap={'4px'}
fontSize={'sm'}
{...props}
>
{list.map((item) => (
<Flex
key={item.value}
flex={'1 0 0'}
alignItems={'center'}
justifyContent={'center'}
cursor={'pointer'}
borderRadius={'md'}
px={px}
py={py}
userSelect={'none'}
whiteSpace={'noWrap'}
{...(value === item.value
? {
bg: 'white',
boxShadow: '1.5',
color: 'primary.600'
}
: {
onClick: () => onChange(item.value)
})}
>
{item.icon && <MyIcon name={item.icon as any} mr={1} w={'14px'} />}
<Box>{item.label}</Box>
</Flex>
))}
</Box>
);
};
export default FillRowTabs;