import {Box, Wrap, WrapItem} from '@chakra-ui/react' import {JaenPageProvider} from '../../internal/services/page' import {ComponentMeta, Story} from '@storybook/react' import React from 'react' import Component from '.' import {connectSection} from '../../../..' import {EditButton} from '../../ui/toolbar' import TextField from '../TextField' export default { title: 'fields/SectionField', component: Component, decorators: [ Story => ( ) ] } as ComponentMeta type ComponentProps = React.ComponentProps // Create a template for the component const Template: Story = args => //#region > Sections const BoxSection = connectSection( () => ( BoxSection ), {name: 'BoxSection', displayName: 'Box Section'} ) const FieldsSection = connectSection( () => ( ), {name: 'FieldsSection', displayName: 'Fields Section'} ) //#endregion export const NoSections: Story = Template.bind({}) NoSections.args = { name: 'section-field', displayName: 'Section Field', sections: [] } export const Empty: Story = Template.bind({}) Empty.args = { name: 'section-field', displayName: 'Section Field', sections: [BoxSection] } export const Filled: Story = Template.bind({}) Filled.args = { name: 'section-field-filled', displayName: 'Section Field', sections: [BoxSection] } export const WithFields: Story = Template.bind({}) WithFields.args = { name: 'section-field-filled', displayName: 'Section Field with inner fields', sections: [FieldsSection] } export const MultipleSections: Story = Template.bind({}) MultipleSections.args = { name: 'section-field-filled', displayName: 'Section Field with multiple sections', sections: [BoxSection, FieldsSection] } export const Styled: Story = Template.bind({}) Styled.args = { name: 'section-field-filled', displayName: 'Section Field with inner fields', sections: [BoxSection], style: { border: 'red 1px solid' }, sectionStyle: { border: 'blue 1px solid', maxWidth: '100px' } } export const Wrapped: Story = Template.bind({}) Wrapped.args = { name: 'section-field-filled', displayName: 'Section Field with inner fields', sections: [BoxSection], as: Wrap, sectionAs: WrapItem, props: { justify: 'center' } }