'use client' import type { FC } from 'react' import React from 'react' import cn from 'classnames' type Option = { value: string text: string | JSX.Element } type ItemProps = { className?: string isActive: boolean onClick: (v: string) => void option: Option } const Item: FC = ({ className, isActive, onClick, option, }) => { return (
!isActive && onClick(option.value)} >
{option.text}
{isActive && (
)}
) } type Props = { className?: string value: string onChange: (v: string) => void options: Option[] noBorderBottom?: boolean itemClassName?: string } const TabSlider: FC = ({ className, value, onChange, options, noBorderBottom, itemClassName, }) => { return (
{options.map(option => ( ))}
) } export default React.memo(TabSlider)