-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBreadcrumb.stories.tsx
More file actions
51 lines (50 loc) · 1.45 KB
/
Breadcrumb.stories.tsx
File metadata and controls
51 lines (50 loc) · 1.45 KB
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
import type { Meta, StoryObj } from '@storybook/react'
import { ConfigProvider } from '../../hooks/useConfig.js'
import Breadcrumb from './Breadcrumb.js'
const meta: Meta<typeof Breadcrumb> = {
component: Breadcrumb,
}
export default meta
type Story = StoryObj<typeof Breadcrumb>;
export const Default: Story = {
args: {
source: {
kind: 'file',
sourceId: '/part1/part2/file.txt',
fileName: 'file.txt',
resolveUrl: '/part1/part2/file.txt',
sourceParts: [
{ text: '/', sourceId: '/' },
{ text: 'part1/', sourceId: '/part1/' },
{ text: 'part2/', sourceId: '/part1/part2/' },
],
fetchVersions: () => {
return Promise.resolve({
label: 'Branches',
versions: [
{ label: 'master', sourceId: '/part1/part2/file.txt' },
{ label: 'dev', sourceId: '/part1/part2/file.txt?branch=dev' },
{ label: 'refs/convert/parquet', sourceId: '/part1/part2/file.txt?branch=refs/convert/parquet' },
],
})
},
},
},
render: (args) => {
const config = {
routes: {
getSourceRouteUrl: ({ sourceId }: { sourceId: string }) => `/files?key=${sourceId}`,
},
customClass: {
versions: 'custom-versions',
},
}
return (
<ConfigProvider value={config}>
<Breadcrumb {...args}>
<input type='text' placeholder="Search..." />
</Breadcrumb>
</ConfigProvider>
)
},
}