import { Meta, StoryObj } from '@storybook/react-webpack5'; import { LayoutGrid, Shield, Database, AlertCircle, Plus, RefreshCw, Trash2, } from 'lucide-react'; import KubernetesLogo from '@/assets/ico/vendor/kubernetes.svg'; import DockerLogo from '@/assets/ico/vendor/docker.svg'; import PodmanLogo from '@/assets/ico/vendor/podman.svg'; import { ResourceDetailHeaderSkeleton } from './ResourceDetailHeaderSkeleton'; import { ResourceDetailHeader } from './ResourceDetailHeader'; import { ActionBarButton } from './ActionBarButton'; import { ActionBarShell } from './ActionBarShell'; import { HeaderStats } from './HeaderStats'; import { ResourceStatBlock } from './ResourceStatBlock'; // Mirrors the env-group platform breakdown used by GroupHeader on // feat/R8S-813. Vertical stack of engine-icon + count + name rows so // mixed-platform groups stay scannable in the right column. const platformBreakdown = ( 3 Kubernetes 1 Docker 1 Podman ); const meta: Meta = { title: 'Design System/ResourceDetailHeader', component: ResourceDetailHeader, tags: ['autodocs'], }; export default meta; type Story = StoryObj; /** * Demonstrates the optional `actionBar` slot. * * Wrap content in `` to get the standard bottom-segment * styling (rounded bottom, border, tint). Children inside the shell * naturally split left/right because `ActionBarShell` is `justify-between`. * Pass a custom element to `actionBar` directly if you need a different * layout. */ export const ActionBar: Story = { args: { title: 'Production Cluster', icon: ( ), subtitleLabel: 'Environment Group', description: 'Resource detail header with the action bar slot in use', }, render: (args) => (
{}} data-cy="action-bar-add-environments" > Add Environments {}} data-cy="action-bar-sync" > Sync
{}} data-cy="action-bar-delete" > Delete
} /> ), }; /** * Demonstrates the optional `rightInfo` slot with `HeaderStats` and * `ResourceStatBlock` — the standard pattern for showing health/status cards * on the right of the header. */ export const StatBlocks: Story = { args: { title: 'orders-api', icon: ( ), subtitleLabel: 'GitOps Source', description: 'Synced from origin/main · 14 services', rightInfo: ( Sync Status Synced Last reconciled 2 min ago Health 3/3 ), }, }; /** * The full env-group detail-header pattern, mirroring how GroupHeader uses * `ResourceDetailHeader` in the environment-group ItemView: a vertical * platform breakdown stat block, a centred policies count stat block, and * a borderless Refresh / Add environments / Delete action bar. */ export const WithStatBlocksAndActionBar: Story = { args: { title: 'Production Cluster', icon: ( ), subtitleLabel: 'Environment Group', description: 'Main production environment group', }, render: (args) => ( Environments {platformBreakdown} }> Policies 3 } actionBar={
{}} data-cy="combined-example-refresh" > Refresh {}} data-cy="combined-example-add" > Add environments
{}} data-cy="combined-example-delete" > Delete
} /> ), }; export const Default: Story = { args: { title: 'Production Cluster', icon: , subtitleLabel: 'Environment Group', description: 'Main production environment group', }, }; export const WithBadge: Story = { args: { ...Default.args, badge: ( Multi-platform ), }, }; export const MinimalUsage: Story = { args: { title: 'Simple Group', icon: , }, }; export const LoadingState: Story = { render: () => ( ), }; export const LoadingStateNoActionBar: Story = { render: () => ( ), }; export const CustomIconBackground: Story = { args: { ...Default.args, icon: , iconBackgroundClassName: 'bg-warning-3 th-dark:bg-warning-10', }, }; export const WithoutDescription: Story = { args: { ...Default.args, description: undefined, }, }; export const WithoutStats: Story = { args: { ...Default.args, rightInfo: undefined, }, }; export const LongTitle: Story = { args: { ...Default.args, title: 'Very Long Environment Group Name That Might Wrap to Multiple Lines in Some Contexts', description: 'This group contains multiple types of container engines including Docker, Kubernetes, and Podman installations', }, }; export const DevelopmentGroup: Story = { args: { title: 'Development Environments', icon: , iconBackgroundClassName: 'bg-success-3 th-dark:bg-success-10', subtitleLabel: 'Environment Group', description: 'Development and testing environments for team collaboration', badge: ( Dev ), }, }; export const StagingGroup: Story = { args: { title: 'Staging Environment', icon: , iconBackgroundClassName: 'bg-orange-3 th-dark:bg-orange-10', subtitleLabel: 'Environment Group', description: 'Staging and pre-production validation environment', badge: ( Staging ), }, }; export const PolicyExample: Story = { args: { title: 'Security Policy', icon: , iconBackgroundClassName: 'bg-blue-3 th-dark:bg-blue-9', subtitleLabel: 'Policy', subtitleClassName: 'text-blue-10 th-dark:text-blue-8', badge: ( Docker ), rightInfo: (
12 environments targeted
), }, }; export const CustomSubtitleColor: Story = { args: { title: 'Custom Entity', icon: , iconBackgroundClassName: 'bg-purple-3 th-dark:bg-purple-9', subtitleLabel: 'Custom Type', subtitleClassName: 'text-purple-10 th-dark:text-purple-8', description: 'Demonstrates custom subtitle color for different entity types', }, }; export const EnvironmentGroup: Story = { args: { title: 'Production Cluster', icon: ( ), subtitleLabel: 'Environment Group', description: 'Main production environment group', }, render: (args) => (
{}} data-cy="add-environments-button" > Add Environments
{}} data-cy="delete-environment-group-button" > Delete
} /> ), };