Skip to content

Commit be1d4c2

Browse files
authored
DS Storybook - Add DataFilters story (#5814)
* Add story for Search * address feedback from review * Change textAlign to commonArg * Add DataFilters story * Add DataTable to example
1 parent 41f1b0d commit be1d4c2

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import React from 'react';
2+
import type { Meta, StoryObj } from '@storybook/react';
3+
import { Data, DataFilter, DataFilters, DataTable } from 'grommet';
4+
5+
const meta = {
6+
title: 'Components/DataFilters',
7+
component: DataFilters,
8+
argTypes: {
9+
clearFilters: {
10+
control: { type: 'boolean' },
11+
},
12+
drop: {
13+
control: { type: 'boolean' },
14+
},
15+
heading: {
16+
control: { type: 'text' },
17+
},
18+
layer: {
19+
control: { type: 'boolean' },
20+
},
21+
},
22+
} satisfies Meta<typeof DataFilters>;
23+
24+
export default meta;
25+
type Story = StoryObj<typeof meta>;
26+
27+
export const Default = {
28+
name: 'DataFilters',
29+
render: args => (
30+
<Data
31+
data={[
32+
{
33+
name: 'Bryan',
34+
location: 'Fort Collins',
35+
date: '2018-06-10',
36+
percent: 30,
37+
paid: 1234,
38+
},
39+
{
40+
name: 'Chris',
41+
location: 'Palo Alto',
42+
date: '2018-06-09',
43+
percent: 40,
44+
paid: 2345,
45+
},
46+
{
47+
name: 'Eric',
48+
location: 'Palo Alto',
49+
date: '2018-06-11',
50+
percent: 80,
51+
paid: 3456,
52+
},
53+
]}
54+
>
55+
<DataFilters {...args}>
56+
<DataFilter property="name" />
57+
<DataFilter property="location" />
58+
<DataFilter property="percent" />
59+
<DataFilter property="paid" />
60+
</DataFilters>
61+
<DataTable
62+
columns={[
63+
{
64+
property: 'name',
65+
header: 'Name',
66+
},
67+
{
68+
property: 'location',
69+
header: 'Location',
70+
},
71+
{
72+
property: 'date',
73+
header: 'Date',
74+
},
75+
{
76+
property: 'percent',
77+
header: 'Percent',
78+
},
79+
{
80+
property: 'paid',
81+
header: 'Paid',
82+
},
83+
]}
84+
/>
85+
</Data>
86+
),
87+
args: {
88+
clearFilters: false,
89+
drop: false,
90+
heading: 'Filters',
91+
layer: true,
92+
},
93+
} satisfies Story;

0 commit comments

Comments
 (0)