-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e615c0
commit 8002018
Showing
1 changed file
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
import { File, Files, Folder } from 'fumadocs-ui/components/files' | ||
|
||
const meta: Meta<typeof Files> = { | ||
title: '๐ Docs Site/Files', | ||
component: Files, | ||
tags: ['autodocs'], | ||
parameters: { | ||
layout: 'centered', | ||
}, | ||
argTypes: { | ||
name: { | ||
control: 'text', | ||
description: 'The name of the file or folder', | ||
}, | ||
disabled: { | ||
control: 'boolean', | ||
description: 'Disables the folder interaction', | ||
defaultValue: false, | ||
}, | ||
icon: { | ||
control: 'object', | ||
description: 'Optional icon component to display', | ||
}, | ||
}, | ||
} | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof Files> | ||
|
||
export const Default: Story = { | ||
render: () => ( | ||
<Files> | ||
<Folder name="app" defaultOpen> | ||
<Folder name="[id]"> | ||
<File name="page.tsx" /> | ||
</Folder> | ||
<File name="layout.tsx" /> | ||
<File name="page.tsx" /> | ||
<File name="global.css" /> | ||
</Folder> | ||
<Folder name="components"> | ||
<File name="button.tsx" /> | ||
<File name="tabs.tsx" /> | ||
<File name="dialog.tsx" /> | ||
</Folder> | ||
<File name="package.json" /> | ||
</Files> | ||
), | ||
} | ||
|
||
export const FolderDisabled: Story = { | ||
render: () => ( | ||
<Files> | ||
<Folder name="app" disabled> | ||
<File name="layout.tsx" /> | ||
<File name="page.tsx" /> | ||
</Folder> | ||
<Folder name="components" disabled> | ||
<File name="button.tsx" /> | ||
<File name="dialog.tsx" /> | ||
</Folder> | ||
</Files> | ||
), | ||
} | ||
|
||
export const CustomIcons: Story = { | ||
render: () => ( | ||
<Files> | ||
<Folder name="app" defaultOpen icon={<span>๐</span>}> | ||
<File name="layout.tsx" icon={<span>๐</span>} /> | ||
<File name="page.tsx" icon={<span>๐</span>} /> | ||
</Folder> | ||
<Folder name="components" icon={<span>โ๏ธ</span>}> | ||
<File name="button.tsx" icon={<span>๐ ๏ธ</span>} /> | ||
<File name="dialog.tsx" icon={<span>๐ ๏ธ</span>} /> | ||
</Folder> | ||
<File name="package.json" icon={<span>๐ฆ</span>} /> | ||
</Files> | ||
), | ||
} |