-
Notifications
You must be signed in to change notification settings - Fork 26
DS Storybook - add toolbar story #5813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,67 @@ | ||||||||||||||||||||||||||||||||||||
| import React from 'react'; | ||||||||||||||||||||||||||||||||||||
| import type { Meta, StoryObj } from '@storybook/react'; | ||||||||||||||||||||||||||||||||||||
| import { Data, DataSearch, DataSort, DataSummary, Toolbar } from 'grommet'; | ||||||||||||||||||||||||||||||||||||
| import { gapArg } from '../utils/commonArgs'; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| // Mock data for the toolbar example | ||||||||||||||||||||||||||||||||||||
| const mockApplications = [ | ||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||
| id: 1, | ||||||||||||||||||||||||||||||||||||
| title: 'scikit-learn', | ||||||||||||||||||||||||||||||||||||
| publisher: 'scikit-learn', | ||||||||||||||||||||||||||||||||||||
| categories: ['Machine learning', 'Developer tools'], | ||||||||||||||||||||||||||||||||||||
| rating: 4.8, | ||||||||||||||||||||||||||||||||||||
| pricing: 'Free', | ||||||||||||||||||||||||||||||||||||
| delivery: 'Package manager', | ||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||
| id: 2, | ||||||||||||||||||||||||||||||||||||
| title: 'Personalizer', | ||||||||||||||||||||||||||||||||||||
| publisher: 'Acme Software Co.', | ||||||||||||||||||||||||||||||||||||
| categories: ['Machine learning', 'Developer tools'], | ||||||||||||||||||||||||||||||||||||
| rating: 4.1, | ||||||||||||||||||||||||||||||||||||
| pricing: 'Free trial', | ||||||||||||||||||||||||||||||||||||
| delivery: 'Web application', | ||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||
| id: 3, | ||||||||||||||||||||||||||||||||||||
| title: 'TensorFlow', | ||||||||||||||||||||||||||||||||||||
| publisher: 'Google', | ||||||||||||||||||||||||||||||||||||
| categories: ['Machine learning', 'Developer tools'], | ||||||||||||||||||||||||||||||||||||
| rating: 4.6, | ||||||||||||||||||||||||||||||||||||
| pricing: 'Free', | ||||||||||||||||||||||||||||||||||||
| delivery: 'Package manager', | ||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| const meta = { | ||||||||||||||||||||||||||||||||||||
| title: 'Components/Toolbar', | ||||||||||||||||||||||||||||||||||||
| component: Toolbar, | ||||||||||||||||||||||||||||||||||||
| argTypes: { | ||||||||||||||||||||||||||||||||||||
| gap: gapArg, | ||||||||||||||||||||||||||||||||||||
britt6612 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||
| parameters: { | ||||||||||||||||||||||||||||||||||||
| layout: 'padded', | ||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+39
to
+41
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||||||||||||||||||||||||||||||||||||
| } satisfies Meta<typeof Toolbar>; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| export default meta; | ||||||||||||||||||||||||||||||||||||
| type Story = StoryObj<typeof meta>; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| export const WithDataControls: Story = { | ||||||||||||||||||||||||||||||||||||
| name: 'Toolbar with Data Controls', | ||||||||||||||||||||||||||||||||||||
britt6612 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||
| args: { | ||||||||||||||||||||||||||||||||||||
| gap: 'small', | ||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||
| render: args => { | ||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||
| <Data data={mockApplications}> | ||||||||||||||||||||||||||||||||||||
| <Toolbar {...args}> | ||||||||||||||||||||||||||||||||||||
| <DataSearch /> | ||||||||||||||||||||||||||||||||||||
| <DataSort drop /> | ||||||||||||||||||||||||||||||||||||
| </Toolbar> | ||||||||||||||||||||||||||||||||||||
| <DataSummary /> | ||||||||||||||||||||||||||||||||||||
| </Data> | ||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+50
to
+92
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we remove unused data? Or is there plan to pass it down to
<Data data={DATA}>to ensure data sort by drop down is not empty like we have on community storybook for data filters?community storybook

core storybook

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added Data as well as DataTable as we decided yesterday in our dev chat