Skip to content
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

chore: allow changing args in stories #82

Merged
merged 1 commit into from
Jan 22, 2025
Merged

Conversation

artemmufazalov
Copy link
Member

@artemmufazalov artemmufazalov commented Jan 22, 2025

  • Refactor stories components
  • Allow changing cache and virtualize props in stories

The reason: I plan to add additional param to NavigationTree, so I prepare stories, so this new param could be visible in stories.

Screenshot 2025-01-22 at 13 55 53

Comment on lines +55 to +74
export const Default: Meta<NavigationTreeProps> = {
component: NavigationTree,
render: (props) => {
return <Template {...props} />;
},
args: {
fetchPath: fetchPath,
renderAdditionalNodeElements: renderAdditionalNodeElements,
},
};

return (
<NavigationTree
rootState={{
path: '',
name: 'ru/maps/maps_prod',
type: 'database',
collapsed: false,
}}
fetchPath={fetchPathWithLargeResults}
getActions={getActions}
activePath={activePath}
onActivePathUpdate={setActivePath}
virtualize
/>
);
export const Virtualized: Meta<NavigationTreeProps> = {
component: NavigationTree,
render: (props) => {
return <Template {...props} />;
},
args: {
fetchPath: fetchPathWithLargeResults,
virtualize: true,
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass only specific for this stories args, other args will be from default export

Comment on lines +28 to +45
rootState: {
control: false,
},
fetchPath: {
control: false,
},
getActions: {
control: false,
},
renderAdditionalNodeElements: {
control: false,
},
activePath: {
control: false,
},
onActivePathUpdate: {
control: false,
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only allowed changing cache and virtualize, other props are disabled as they were before. The reason - other props are complex and may require some setup, that I do not want to do right now

@artemmufazalov artemmufazalov merged commit 972c0db into main Jan 22, 2025
4 checks passed
@artemmufazalov artemmufazalov deleted the storybook-params branch January 22, 2025 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants