Skip to content

Commit

Permalink
Refactor(web-react): Use correct values for Storybook controls based …
Browse files Browse the repository at this point in the history
…on type
  • Loading branch information
literat committed Jun 20, 2024
1 parent 4cd90d9 commit a39bf9d
Show file tree
Hide file tree
Showing 41 changed files with 111 additions and 123 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Because there is no `dist` directory during the CI run
/* eslint-disable import/no-extraneous-dependencies, import/extensions, import/no-unresolved */
import { ComponentStory } from '@storybook/react';
import { StoryFn } from '@storybook/react';
import React from 'react';
import { Link } from '../../Link';
import { Pill } from '../../Pill';
Expand All @@ -10,7 +10,7 @@ import AccordionItem from '../AccordionItem';
import UncontrolledAccordion from '../UncontrolledAccordion';
import { content } from './Accordion';

const Story: ComponentStory<typeof UncontrolledAccordion> = () => (
const Story: StoryFn<typeof UncontrolledAccordion> = () => (
<UncontrolledAccordion id="accordion-example" defaultOpen="accordion-item-example-1">
<AccordionItem id="accordion-item-example-0">
<AccordionHeader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const meta: Meta<typeof UncontrolledAccordion> = {
component: UncontrolledAccordion,
argTypes: {
defaultOpen: {
control: 'array',
control: 'object',
},
elementType: {
control: 'text',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const meta: Meta<typeof Alert> = {
isCentered: {
control: 'boolean',
table: {
defaultValue: { summary: false },
defaultValue: { summary: 'false' },
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ const meta: Meta<typeof BreadcrumbsItem> = {
isCurrent: {
control: 'boolean',
table: {
defaultValue: { summary: true },
defaultValue: { summary: 'true' },
},
},
isGoBackOnly: {
control: 'boolean',
table: {
defaultValue: { summary: false },
defaultValue: { summary: 'false' },
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,31 @@ const meta: Meta<typeof Checkbox> = {
isDisabled: {
control: 'boolean',
table: {
defaultValue: { summary: false },
defaultValue: { summary: 'false' },
},
},
isChecked: {
control: 'boolean',
table: {
defaultValue: { summary: true },
defaultValue: { summary: 'true' },
},
},
isItem: {
control: 'boolean',
table: {
defaultValue: { summary: false },
defaultValue: { summary: 'false' },
},
},
isLabelHidden: {
control: 'boolean',
table: {
defaultValue: { summary: false },
defaultValue: { summary: 'false' },
},
},
isRequired: {
control: 'boolean',
table: {
defaultValue: { summary: false },
defaultValue: { summary: 'false' },
},
},
label: {
Expand Down
6 changes: 3 additions & 3 deletions packages/web-react/src/components/Collapse/demo/Collapse.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Because there is no `dist` directory during the CI run
/* eslint-disable import/no-extraneous-dependencies, import/extensions, import/no-unresolved */
import { ComponentStory } from '@storybook/react';
import { StoryFn } from '@storybook/react';
import React from 'react';
import { Button } from '../../Button';
import { useCollapse, Collapse } from '../index';
import { Collapse, useCollapse } from '../index';

export const content = (
<>
Expand Down Expand Up @@ -32,7 +32,7 @@ export const CollapseTrigger = ({ isOpen, ...rest }: any) => {
return <Button {...rest}>Collapse Trigger ({isOpen ? 'Open' : 'Closed'})</Button>;
};

const Story: ComponentStory<typeof Collapse> = () => {
const Story: StoryFn<typeof Collapse> = () => {
const { isOpen, toggleHandler } = useCollapse(false);

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Because there is no `dist` directory during the CI run
/* eslint-disable import/no-extraneous-dependencies, import/extensions, import/no-unresolved */
import { ComponentStory } from '@storybook/react';
import { StoryFn } from '@storybook/react';
import React from 'react';
import UncontrolledCollapse from '../UncontrolledCollapse';
import { content, CollapseTrigger } from './Collapse';
import { CollapseTrigger, content } from './Collapse';

const Story: ComponentStory<typeof UncontrolledCollapse> = () => {
const Story: StoryFn<typeof UncontrolledCollapse> = () => {
return (
<div>
{content}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const meta: Meta<typeof Collapse> = {
transitionDuration: {
control: 'number',
table: {
defaultValue: { summary: 250 },
defaultValue: { summary: '250' },
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const meta: Meta<typeof UncontrolledCollapse> = {
transitionDuration: {
control: 'number',
table: {
defaultValue: { summary: 250 },
defaultValue: { summary: '250' },
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ const meta: Meta<typeof Dropdown> = {
enableAutoClose: {
control: 'boolean',
table: {
defaultValue: { summary: true },
defaultValue: { summary: 'true' },
},
},
fullWidthMode: {
control: 'select',
options: [...Object.values(DropdownFullWidthModes), undefined],
table: {
defaultValue: { summary: undefined },
defaultValue: { summary: 'undefined' },
},
},
id: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const meta: Meta<typeof DropdownTrigger> = {
elementType: {
control: 'object',
table: {
defaultValue: { summary: Button },
defaultValue: { summary: 'Button' },
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ const meta: Meta<typeof UncontrolledDropdown> = {
enableAutoClose: {
control: 'boolean',
table: {
defaultValue: { summary: true },
defaultValue: { summary: 'true' },
},
},
fullWidthMode: {
control: 'select',
options: [...Object.values(DropdownFullWidthModes), undefined],
table: {
defaultValue: { summary: undefined },
defaultValue: { summary: 'undefined' },
},
},
id: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,19 @@ const meta: Meta<typeof FieldGroup> = {
isDisabled: {
control: 'boolean',
table: {
defaultValue: { summary: false },
defaultValue: { summary: 'false' },
},
},
isLabelHidden: {
control: 'boolean',
table: {
defaultValue: { summary: false },
defaultValue: { summary: 'false' },
},
},
isRequired: {
control: 'boolean',
table: {
defaultValue: { summary: false },
defaultValue: { summary: 'false' },
},
},
label: {
Expand All @@ -80,7 +80,7 @@ const meta: Meta<typeof FieldGroup> = {
control: 'text',
},
validationState: {
control: 'FieldGroup',
control: 'select',
options: [...Object.values(ValidationStates), undefined],
table: {
defaultValue: { summary: undefined },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React from 'react';
import { SpiritFileUploaderAttachmentProps, SpiritFileUploaderProps } from '../../../types';
import ReadMe from '../README.md';
import { FileUploader, FileUploaderAttachment, FileUploaderInput, FileUploaderList, useFileQueue } from '..';
import { fn } from '@storybook/test';

const meta: Meta<typeof FileUploader> = {
title: 'Components/FileUploader',
Expand All @@ -14,43 +15,33 @@ const meta: Meta<typeof FileUploader> = {
},
},
argTypes: {
addToQueue: {
control: 'function',
},
children: {
control: 'text',
},
clearQueue: {
control: 'function',
},
errorMessages: {
control: 'object',
},
fileQueue: {
control: 'object',
},
findInQueue: {
control: 'function',
},
id: {
control: 'text',
},
isFluid: {
control: 'boolean',
table: {
defaultValue: { summary: false },
defaultValue: { summary: 'false' },
},
},
onDismiss: {
control: 'function',
},
updateQueue: {
control: 'function',
},
},
args: {
id: 'file-uploader',
isFluid: false,
fileInQueue: fn(),
onDismiss: fn(),
updateQueue: fn(),
clearQueue: fn(),
addToQueue: fn(),
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const meta: Meta<typeof FileUploaderAttachment> = {
hasImagePreview: {
control: 'boolean',
table: {
defaultValue: { summary: false },
defaultValue: { summary: 'false' },
},
},
iconName: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@ const meta: Meta<typeof FileUploaderInput> = {
isDisabled: {
control: 'boolean',
table: {
defaultValue: { summary: false },
defaultValue: { summary: 'false' },
},
},
isLabelHidden: {
control: 'boolean',
table: {
defaultValue: { summary: false },
defaultValue: { summary: 'false' },
},
},
isMultiple: {
control: 'boolean',
table: {
defaultValue: { summary: false },
defaultValue: { summary: 'false' },
},
},
isRequired: {
control: 'boolean',
table: {
defaultValue: { summary: false },
defaultValue: { summary: 'false' },
},
},
label: {
Expand All @@ -59,13 +59,13 @@ const meta: Meta<typeof FileUploaderInput> = {
maxFileSize: {
control: 'number',
table: {
defaultValue: { summary: 1000000 },
defaultValue: { summary: '1000000' },
},
},
maxUploadedFiles: {
control: 'number',
table: {
defaultValue: { summary: 10 },
defaultValue: { summary: '10' },
},
},
name: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const meta: Meta<typeof FileUploaderList> = {
hasImagePreview: {
control: 'boolean',
table: {
defaultValue: { summary: false },
defaultValue: { summary: 'false' },
},
},
id: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,31 +38,31 @@ const meta: Meta<typeof UncontrolledFileUploader> = {
isDisabled: {
control: 'boolean',
table: {
defaultValue: { summary: false },
defaultValue: { summary: 'false' },
},
},
isFluid: {
control: 'boolean',
table: {
defaultValue: { summary: false },
defaultValue: { summary: 'false' },
},
},
isLabelHidden: {
control: 'boolean',
table: {
defaultValue: { summary: false },
defaultValue: { summary: 'false' },
},
},
isMultiple: {
control: 'boolean',
table: {
defaultValue: { summary: false },
defaultValue: { summary: 'false' },
},
},
isRequired: {
control: 'boolean',
table: {
defaultValue: { summary: false },
defaultValue: { summary: 'false' },
},
},
labelText: {
Expand All @@ -77,13 +77,13 @@ const meta: Meta<typeof UncontrolledFileUploader> = {
maxFileSize: {
control: 'number',
table: {
defaultValue: { summary: 1000000 },
defaultValue: { summary: '1000000' },
},
},
maxUploadedFiles: {
control: 'number',
table: {
defaultValue: { summary: 10 },
defaultValue: { summary: '10' },
},
},
queueLimitBehavior: {
Expand Down
Loading

0 comments on commit a39bf9d

Please sign in to comment.