mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 09:05:56 +08:00

Co-authored-by: StyleZhang <jasonapring2015@outlook.com> Co-authored-by: Garfield Dai <dai.hai@foxmail.com> Co-authored-by: chenhe <guchenhe@gmail.com> Co-authored-by: jyong <jyong@dify.ai> Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: Yeuoly <admin@srmxy.cn>
46 lines
868 B
TypeScript
46 lines
868 B
TypeScript
import type { FC } from 'react'
|
|
|
|
type TabProps = {
|
|
active: string
|
|
onSelect: (active: string) => void
|
|
}
|
|
const Tab: FC<TabProps> = ({
|
|
active,
|
|
onSelect,
|
|
}) => {
|
|
const tabs = [
|
|
{
|
|
key: 'all',
|
|
text: 'All',
|
|
},
|
|
{
|
|
key: 'added',
|
|
text: 'Added',
|
|
},
|
|
{
|
|
key: 'build-in',
|
|
text: 'Build-in',
|
|
},
|
|
]
|
|
return (
|
|
<div className='flex items-center'>
|
|
{
|
|
tabs.map(tab => (
|
|
<div
|
|
key={tab.key}
|
|
className={`
|
|
flex items-center mr-1 px-[5px] h-[18px] rounded-md text-xs cursor-pointer
|
|
${active === tab.key ? 'bg-gray-200 font-medium text-gray-900' : 'text-gray-500 font-normal'}
|
|
`}
|
|
onClick={() => onSelect(tab.key)}
|
|
>
|
|
{tab.text}
|
|
</div>
|
|
))
|
|
}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default Tab
|