From 715347ebda39c5c72310036284df81555812ce1e Mon Sep 17 00:00:00 2001 From: mufazalov Date: Wed, 22 Jan 2025 13:44:54 +0300 Subject: [PATCH] chore: allow changing args in stories --- .../__stories__/NavigationTree.stories.tsx | 90 ++++++++++++------- 1 file changed, 56 insertions(+), 34 deletions(-) diff --git a/src/components/NavigationTree/__stories__/NavigationTree.stories.tsx b/src/components/NavigationTree/__stories__/NavigationTree.stories.tsx index 785a009..21bd092 100644 --- a/src/components/NavigationTree/__stories__/NavigationTree.stories.tsx +++ b/src/components/NavigationTree/__stories__/NavigationTree.stories.tsx @@ -1,55 +1,77 @@ import React from 'react'; import {Button} from '@gravity-ui/uikit'; -import type {Meta, Story} from '@storybook/react'; +import type {Meta, StoryFn} from '@storybook/react'; import {NavigationTree} from '../NavigationTree'; import type {NavigationTreeProps} from '../NavigationTree'; import type {NavigationTreeDataItem, NavigationTreeNodeType} from '../types'; export default { + parameters: { + controls: {expanded: true}, + }, title: 'NavigationTree', component: NavigationTree, + args: { + cache: true, + virtualize: false, + rootState: { + path: '', + name: 'ru/maps/maps_prod', + type: 'database', + collapsed: false, + }, + getActions: getActions, + }, + argTypes: { + rootState: { + control: false, + }, + fetchPath: { + control: false, + }, + getActions: { + control: false, + }, + renderAdditionalNodeElements: { + control: false, + }, + activePath: { + control: false, + }, + onActivePathUpdate: { + control: false, + }, + }, } as Meta; -export const Default: Story = () => { +const Template: StoryFn = (props) => { const [activePath, setActivePath] = React.useState(''); - return ( - - ); + return ; }; -export const Virtualized: Story = () => { - const [activePath, setActivePath] = React.useState(''); +export const Default: Meta = { + component: NavigationTree, + render: (props) => { + return