({
text,
selected,
setSelected,
customID,
icon: Icon,
}: TabProps)
| 10 | } |
| 11 | |
| 12 | const Tab = ({ |
| 13 | text, |
| 14 | selected, |
| 15 | setSelected, |
| 16 | customID, |
| 17 | icon: Icon, |
| 18 | }: TabProps) => { |
| 19 | return ( |
| 20 | <button |
| 21 | onClick={() => setSelected(text)} |
| 22 | className={ |
| 23 | (selected ? 'text-red-500' : 'hover:text-red-500') + |
| 24 | ' relative rounded-md px-2 py-1 text-sm font-medium text-gray-500 transition-colors duration-300' |
| 25 | } |
| 26 | > |
| 27 | <div className="flex items-center space-x-1"> |
| 28 | {Icon && ( |
| 29 | <Icon |
| 30 | className={ |
| 31 | selected ? 'h-4 w-4 text-red-500' : 'h-4 w-4 text-gray-400' |
| 32 | } |
| 33 | /> |
| 34 | )} |
| 35 | <span |
| 36 | className={`relative z-10 capitalize ${selected ? 'text-red-500' : 'text-gray-400'}`} |
| 37 | > |
| 38 | {text} |
| 39 | </span> |
| 40 | </div> |
| 41 | {selected && ( |
| 42 | <motion.div |
| 43 | className="absolute bottom-0 left-0 top-1 flex size-full items-end justify-center" |
| 44 | layoutId={customID + 'linetab'} |
| 45 | transition={{ type: 'spring', duration: 0.4, bounce: 0, delay: 0.1 }} |
| 46 | > |
| 47 | <span className="z-0 h-[3px] w-[60%] rounded-t-full bg-red-500/80"></span> |
| 48 | </motion.div> |
| 49 | )} |
| 50 | </button> |
| 51 | ) |
| 52 | } |
| 53 | |
| 54 | interface AnimatedTabsProps { |
| 55 | tabs?: string[] |
nothing calls this directly
no outgoing calls
no test coverage detected