({ text, selected, setSelected }: TabProps)
| 12 | } |
| 13 | |
| 14 | const Tab = ({ text, selected, setSelected }: TabProps) => { |
| 15 | return ( |
| 16 | <button |
| 17 | onClick={() => setSelected(text)} |
| 18 | className={`${ |
| 19 | selected |
| 20 | ? 'text-white' |
| 21 | : 'text-gray-500 hover:text-gray-900 dark:hover:text-gray-100' |
| 22 | } relative rounded-md px-2 py-1 text-sm font-medium transition-colors`} |
| 23 | > |
| 24 | <span className="relative z-10">{text}</span> |
| 25 | {selected && ( |
| 26 | <motion.span |
| 27 | layoutId="tab" |
| 28 | transition={{ type: 'spring', duration: 0.4 }} |
| 29 | className="absolute inset-0 z-0 rounded-md bg-red-500" |
| 30 | ></motion.span> |
| 31 | )} |
| 32 | </button> |
| 33 | ) |
| 34 | } |
| 35 | |
| 36 | const ButtonShapeTabs = () => { |
| 37 | const [selected, setSelected] = useState<string>(tabs[0]) |
nothing calls this directly
no outgoing calls
no test coverage detected