import type { Meta, StoryObj } from '@storybook/nextjs-vite';
import { Edit, Plus, Trash2 } from 'lucide-react';
import { PageContainer } from '../components/layout/page-container';
import { Button } from '../components/ui/button';
const meta = {
title: 'Layout/PageContainer',
component: PageContainer,
argTypes: {
variant: {
control: 'select',
options: ['list', 'detail', 'form', 'content'],
},
padding: {
control: 'select',
options: ['none', 'sm', 'md', 'lg'],
},
background: {
control: 'select',
options: ['default', 'card', 'transparent'],
},
showHeader: { control: 'boolean' },
},
decorators: [
(Story) => (
),
],
} satisfies Meta;
export default meta;
type Story = StoryObj;
const PlaceholderContent = () => (
);
// === Legacy Usage ===
/**
* Legacy mode — basic container with full-width background.
*/
export const Legacy: Story = {
args: {
children: ,
className: 'px-6',
},
};
/**
* Legacy mode — custom background.
*/
export const LegacyCustomBackground: Story = {
args: {
children: ,
backgroundClassName: 'bg-ods-card',
contentPadding: 'px-6 py-4',
},
};
/**
* Legacy mode — content-width background only.
*/
export const LegacyContentWidthBackground: Story = {
args: {
children: ,
fullWidthBackground: false,
backgroundClassName: 'bg-ods-card',
contentPadding: 'px-6 py-4',
},
};
// === Advanced: List Variant ===
/**
* List page with title and action buttons.
*/
export const ListPage: Story = {
args: {
variant: 'list',
title: 'Devices',
subtitle: '24 devices found',
actions: [
{ label: 'Add Device', onClick: () => {}, icon: , variant: 'accent' },
],
children: ,
},
};
/**
* List page with multiple actions.
*/
export const ListPageMultipleActions: Story = {
args: {
variant: 'list',
title: 'Scripts',
subtitle: 'Manage your scripts',
actions: [
{ label: 'Edit', onClick: () => {}, icon: , variant: 'outline' },
{ label: 'Create Script', onClick: () => {}, icon: , variant: 'accent' },
],
children: ,
},
};
// === Advanced: Detail Variant ===
/**
* Detail page with back button.
*/
export const DetailPage: Story = {
args: {
variant: 'detail',
title: 'Device Details',
subtitle: 'MacBook Pro — Online',
backButton: { label: 'Back to Devices', onClick: () => {} },
children: ,
},
};
/**
* Detail page with actions.
*/
export const DetailPageWithActions: Story = {
args: {
variant: 'detail',
title: 'Script Details',
subtitle: 'Last run: 2 hours ago',
backButton: { onClick: () => {} },
actions: [
{ label: 'Delete', onClick: () => {}, icon: , variant: 'outline' },
{ label: 'Run Script', onClick: () => {}, variant: 'accent' },
],
children: ,
},
};
// === Advanced: Form Variant ===
/**
* Form page with back button and save action.
*/
export const FormPage: Story = {
args: {
variant: 'form',
title: 'Create New Script',
backButton: { label: 'Cancel', onClick: () => {} },
actions: [
{ label: 'Save Draft', onClick: () => {}, variant: 'outline' },
{ label: 'Publish', onClick: () => {}, variant: 'accent' },
],
children: (
),
},
};
// === Advanced: Content Variant ===
/**
* Content page — generic layout.
*/
export const ContentPage: Story = {
args: {
variant: 'content',
title: 'Settings',
children: ,
},
};
// === Header Variations ===
/**
* Page with custom header content.
*/
export const CustomHeaderContent: Story = {
args: {
variant: 'list',
headerContent: (
Custom Header
),
children: ,
},
};
/**
* Page with header actions as ReactNode.
*/
export const WithHeaderActions: Story = {
args: {
variant: 'list',
title: 'Devices',
headerActions: (
),
actions: [
{ label: 'Add Device', onClick: () => {}, icon: , variant: 'accent' },
],
children: ,
},
};
/**
* Page with header hidden.
*/
export const HiddenHeader: Story = {
args: {
variant: 'content',
title: 'This title is hidden',
showHeader: false,
children: ,
},
};
// === Padding & Background ===
/**
* Page with large padding and card background.
*/
export const WithPaddingAndBackground: Story = {
args: {
variant: 'content',
title: 'Padded Page',
padding: 'lg',
background: 'card',
children: ,
},
};