import type { Meta, StoryFn } from '@storybook/react'; import React from 'react'; import { usePropState } from '@anton.bobrov/react-hooks'; import { ExpandContent } from '.'; type TComponent = typeof ExpandContent; const meta: Meta = { title: 'Wrappers/ExpandContent', component: ExpandContent, tags: ['autodocs'], decorators: [ (Story) => (
), ], args: { style: { backgroundColor: '#ccc', }, children: ( <>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum fugiat numquam quia corporis sed, nesciunt aut at expedita sunt. Voluptates quos est adipisci exercitationem nihil nisi impedit labore itaque. Ex!
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorum fugiat numquam quia corporis sed, nesciunt aut at expedita sunt. Voluptates quos est adipisci exercitationem nihil nisi impedit labore itaque. Ex!
), }, argTypes: { onExpandStart: { table: { disable: true } }, onExpandRender: { table: { disable: true } }, onExpandEnd: { table: { disable: true } }, onHiddenContentRender: { table: { disable: true } }, children: { table: { disable: true } }, }, }; export default meta; const Template: StoryFn = ({ isActive: isActiveProp, ...props }) => { const [isActive, setIsActive] = usePropState(isActiveProp); return ( <> ); }; export const Default = Template.bind({}); Default.args = {}; export const DefaultActive = Template.bind({}); DefaultActive.args = { isActive: true, }; export const WithoutAlpha = Template.bind({}); WithoutAlpha.args = { hasAlpha: false, }; export const WithCustomAnimation = Template.bind({}); WithCustomAnimation.args = { isHiddenContentRendered: false, onExpandRender: ({ content, p }) => { const scale = 0.9 + 0.1 * p; const y = 1 - p; // eslint-disable-next-line no-param-reassign content.style.transform = `scale(${scale}) translateY(${y}rem)`; }, };