All files / laravel-saas/resources/js/stories/ui Separator.stories.tsx

0% Statements 0/193
100% Branches 1/1
100% Functions 1/1
0% Lines 0/193

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221                                                                                                                                                                                                                                                                                                                                                                                                                                                         
import type { Meta, StoryObj } from '@storybook/react';
import { Separator } from '@/Components/ui/Separator';
 
const meta = {
    title: 'UI/Separator',
    component: Separator,
    parameters: {
        layout: 'centered',
    },
    tags: ['autodocs'],
    argTypes: {
        orientation: {
            control: 'radio',
            options: ['horizontal', 'vertical'],
            description: 'The orientation of the separator',
        },
        decorative: {
            control: 'boolean',
            description: 'Whether the separator is decorative or semantic',
        },
        className: {
            control: 'text',
            description: 'Additional CSS classes',
        },
    },
} satisfies Meta<typeof Separator>;
 
export default meta;
type Story = StoryObj<typeof meta>;
 
export const Horizontal: Story = {
    args: {
        orientation: 'horizontal',
    },
    render: (args) => (
        <div className="w-96">
            <div className="space-y-1">
                <h4 className="text-sm font-medium leading-none">Radix Primitives</h4>
                <p className="text-sm text-muted-foreground">
                    An open-source UI component library.
                </p>
            </div>
            <Separator {...args} className="my-4" />
            <div className="flex h-5 items-center space-x-4 text-sm">
                <div>Blog</div>
                <Separator orientation="vertical" />
                <div>Docs</div>
                <Separator orientation="vertical" />
                <div>Source</div>
            </div>
        </div>
    ),
};
 
export const Vertical: Story = {
    args: {
        orientation: 'vertical',
    },
    render: (args) => (
        <div className="flex h-20 items-center">
            <div className="text-sm">Left content</div>
            <Separator {...args} className="mx-4 h-full" />
            <div className="text-sm">Right content</div>
        </div>
    ),
};
 
export const InList: Story = {
    render: () => (
        <div className="w-96">
            <h3 className="mb-4 text-lg font-semibold">Team Members</h3>
            <div className="space-y-4">
                {[
                    { name: 'John Doe', role: 'Developer', email: 'john@example.com' },
                    { name: 'Jane Smith', role: 'Designer', email: 'jane@example.com' },
                    { name: 'Bob Johnson', role: 'Manager', email: 'bob@example.com' },
                ].map((member, index) => (
                    <div key={member.email}>
                        <div className="flex justify-between">
                            <div>
                                <p className="font-medium">{member.name}</p>
                                <p className="text-sm text-muted-foreground">{member.role}</p>
                            </div>
                            <p className="text-sm text-muted-foreground">{member.email}</p>
                        </div>
                        {index < 2 && <Separator className="mt-4" />}
                    </div>
                ))}
            </div>
        </div>
    ),
};
 
export const InForm: Story = {
    render: () => (
        <form className="w-96 space-y-6">
            <div>
                <h3 className="text-lg font-medium">Personal Information</h3>
                <p className="text-sm text-muted-foreground">
                    Update your personal details here.
                </p>
            </div>
            <Separator />
            <div className="space-y-4">
                <div>
                    <label className="text-sm font-medium">Name</label>
                    <input
                        type="text"
                        className="mt-1 flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"
                        placeholder="Enter your name"
                    />
                </div>
                <div>
                    <label className="text-sm font-medium">Email</label>
                    <input
                        type="email"
                        className="mt-1 flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"
                        placeholder="Enter your email"
                    />
                </div>
            </div>
            <Separator />
            <div>
                <h3 className="text-lg font-medium">Account Settings</h3>
                <p className="text-sm text-muted-foreground">
                    Manage your account preferences.
                </p>
            </div>
            <div className="space-y-4">
                <div className="flex items-center space-x-2">
                    <input type="checkbox" id="notifications" />
                    <label htmlFor="notifications" className="text-sm font-medium">
                        Email notifications
                    </label>
                </div>
                <div className="flex items-center space-x-2">
                    <input type="checkbox" id="marketing" />
                    <label htmlFor="marketing" className="text-sm font-medium">
                        Marketing emails
                    </label>
                </div>
            </div>
        </form>
    ),
};
 
export const WithCustomColor: Story = {
    render: () => (
        <div className="w-96 space-y-4">
            <div>
                <p>Default separator</p>
                <Separator className="my-2" />
            </div>
            <div>
                <p>Primary colored separator</p>
                <Separator className="my-2 bg-primary" />
            </div>
            <div>
                <p>Thick separator</p>
                <Separator className="my-2 h-1" />
            </div>
            <div>
                <p>Dashed separator</p>
                <div className="my-2 border-t-2 border-dashed border-border" />
            </div>
        </div>
    ),
};
 
export const InNavigation: Story = {
    render: () => (
        <nav className="flex items-center space-x-4">
            <a href="#" className="text-sm font-medium">Home</a>
            <Separator orientation="vertical" className="h-4" />
            <a href="#" className="text-sm font-medium">Products</a>
            <Separator orientation="vertical" className="h-4" />
            <a href="#" className="text-sm font-medium">Services</a>
            <Separator orientation="vertical" className="h-4" />
            <a href="#" className="text-sm font-medium">About</a>
            <Separator orientation="vertical" className="h-4" />
            <a href="#" className="text-sm font-medium">Contact</a>
        </nav>
    ),
};
 
export const InCard: Story = {
    render: () => (
        <div className="w-96 rounded-lg border bg-card p-6">
            <div className="flex items-center justify-between">
                <h3 className="text-lg font-semibold">Card Title</h3>
                <span className="text-sm text-muted-foreground">3 min ago</span>
            </div>
            <Separator className="my-4" />
            <p className="text-sm text-muted-foreground">
                This is some card content that is separated from the header using a separator component.
                It provides a clean visual break between sections.
            </p>
            <Separator className="my-4" />
            <div className="flex justify-between text-sm">
                <button className="text-primary hover:underline">Learn more</button>
                <button className="text-muted-foreground hover:text-foreground">Dismiss</button>
            </div>
        </div>
    ),
};
 
export const Decorative: Story = {
    render: () => (
        <div className="w-96 text-center">
            <h2 className="text-2xl font-bold">Welcome</h2>
            <div className="mx-auto my-6 flex items-center justify-center space-x-2">
                <Separator className="w-16" />
                <span className="text-muted-foreground">✦</span>
                <Separator className="w-16" />
            </div>
            <p className="text-muted-foreground">
                Thank you for joining our platform. We're excited to have you here!
            </p>
        </div>
    ),
};