TabPreview.tsx 778 B

12345678910111213141516171819202122232425
  1. import { motion } from 'framer-motion'
  2. import { EntityTypeIcon } from '@/components/ui/EntityTypeIcon'
  3. import { useTabsStateSnapshot } from '@/state/tabs'
  4. export const TabPreview = ({ tab }: { tab: string }) => {
  5. const tabs = useTabsStateSnapshot()
  6. const tabData = tabs.tabsMap[tab]
  7. if (!tabData) return null
  8. return (
  9. <motion.div
  10. layoutId={tab}
  11. transition={{ duration: 0.045 }}
  12. animate={{ opacity: 0.7 }}
  13. className="flex relative items-center gap-2 px-3 text-xs bg-dash-sidebar dark:bg-surface-100 shadow-lg rounded-xs h-10"
  14. >
  15. <EntityTypeIcon type={tabData.type} />
  16. <span>{tabData.label || 'Untitled'}</span>
  17. <div className="absolute w-full top-0 left-0 right-0 h-px bg-foreground-muted" />
  18. </motion.div>
  19. )
  20. }