| | |
| | | 'use client' |
| | | import type { FC } from 'react' |
| | | import React from 'react' |
| | | import s from './style.module.css' |
| | | import cn from '@/utils/classnames' |
| | | |
| | | type Item = { |
| | | id: string |
| | | name: string |
| | | isRight?: boolean |
| | | icon?: React.ReactNode |
| | | extra?: React.ReactNode |
| | | } |
| | | |
| | |
| | | value, |
| | | onChange, |
| | | }) => { |
| | | const renderItem = ({ id, name, icon, extra }: Item) => ( |
| | | const renderItem = ({ id, name, extra }: Item) => ( |
| | | <div |
| | | key={id} |
| | | className={cn( |
| | | 'system-md-semibold relative flex cursor-pointer items-center border-b-2 border-transparent pb-2 pt-2.5', |
| | | id === value ? 'border-components-tab-active text-text-primary' : 'text-text-tertiary', |
| | | )} |
| | | className={cn(id === value ? `${s.itemActive} text-gray-900` : 'text-gray-500', 'relative flex items-center pb-1.5 leading-6 cursor-pointer')} |
| | | onClick={() => onChange(id)} |
| | | > |
| | | {icon || ''} |
| | | <div className='ml-2'>{name}</div> |
| | | <div className='text-base font-semibold'>{name}</div> |
| | | {extra || ''} |
| | | </div> |
| | | ) |
| | | return ( |
| | | <div className='flex justify-between'> |
| | | <div className='flex justify-between border-b border-gray-200 '> |
| | | <div className='flex space-x-4'> |
| | | {items.filter(item => !item.isRight).map(renderItem)} |
| | | </div> |