| 16 | * 收敛此前每个 Tab 各写一套头部导致的视觉不一致。 |
| 17 | */ |
| 18 | const SectionHeader: React.FC<SectionHeaderProps> = ({ |
| 19 | icon: Icon, |
| 20 | title, |
| 21 | description, |
| 22 | actions, |
| 23 | className, |
| 24 | }) => ( |
| 25 | <div className={cn('flex items-start justify-between gap-3', className)}> |
| 26 | <div className="flex min-w-0 items-start gap-3"> |
| 27 | {Icon && ( |
| 28 | <div className="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary"> |
| 29 | <Icon className="h-5 w-5" /> |
| 30 | </div> |
| 31 | )} |
| 32 | <div className="min-w-0"> |
| 33 | <h2 className="text-lg font-semibold leading-tight">{title}</h2> |
| 34 | {description && ( |
| 35 | <p className="mt-1 text-sm text-muted-foreground">{description}</p> |
| 36 | )} |
| 37 | </div> |
| 38 | </div> |
| 39 | {actions && ( |
| 40 | <div className="flex shrink-0 flex-wrap items-center justify-end gap-2"> |
| 41 | {actions} |
| 42 | </div> |
| 43 | )} |
| 44 | </div> |
| 45 | ); |
| 46 | |
| 47 | export default SectionHeader; |