-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate content stories to tsx format (#294)
* migrate breadcrumbs and change url paths to doc * lint fix * migrate content to tsx * migrate content stories to tsx * merge main * clean up * add html bullet points instead of jsdoc comment
- Loading branch information
Showing
12 changed files
with
258 additions
and
281 deletions.
There are no files selected for viewing
47 changes: 0 additions & 47 deletions
47
src/components/content/ContentArea/ContentArea.stories.mdx
This file was deleted.
Oops, something went wrong.
55 changes: 55 additions & 0 deletions
55
src/components/content/ContentArea/ContentArea.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { | ||
Controls, | ||
Description, | ||
Primary, | ||
Stories, | ||
Subheading, | ||
Title, | ||
} from '@storybook/addon-docs' | ||
import { Meta, StoryObj } from '@storybook/react' | ||
import { Theme } from '../../../../.storybook/components' | ||
import { ContentArea } from './ContentArea' | ||
|
||
const meta = { | ||
component: ContentArea, | ||
args: { | ||
children: 'Multiple blocks', | ||
}, | ||
argTypes: { | ||
children: { | ||
options: ['Multiple blocks', 'One block'], | ||
mapping: { | ||
'Multiple blocks': ( | ||
<> | ||
<div className="bg-neutral-200">Block A</div> | ||
<div className="bg-neutral-100">Block B</div> | ||
<div className="bg-neutral-200">Block C</div> | ||
</> | ||
), | ||
'One block': <div className="bg-neutral-200">Block A</div>, | ||
}, | ||
control: { type: 'select' }, | ||
}, | ||
}, | ||
parameters: { | ||
docs: { | ||
page: () => ( | ||
<> | ||
<Title /> | ||
<Description /> | ||
<Primary /> | ||
<Subheading>Props</Subheading> | ||
<Controls /> | ||
<Theme component="content" items={['area']} /> | ||
<Stories /> | ||
</> | ||
), | ||
}, | ||
}, | ||
} satisfies Meta<typeof ContentArea> | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof ContentArea> | ||
|
||
export const Default: Story = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
128 changes: 0 additions & 128 deletions
128
src/components/content/ContentMessage/ContentMessage.stories.mdx
This file was deleted.
Oops, something went wrong.
82 changes: 82 additions & 0 deletions
82
src/components/content/ContentMessage/ContentMessage.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import IconInfo from '@aboutbits/react-material-icons/dist/IconInfo' | ||
import IconWarning from '@aboutbits/react-material-icons/dist/IconWarning' | ||
import IconError from '@aboutbits/react-material-icons/dist/IconError' | ||
import { | ||
Controls, | ||
Description, | ||
Primary, | ||
Stories, | ||
Subheading, | ||
Title, | ||
} from '@storybook/addon-docs' | ||
import { Meta, StoryObj } from '@storybook/react' | ||
import { Theme } from '../../../../.storybook/components' | ||
import { Tone } from '../../types' | ||
import { ContentMessage } from './ContentMessage' | ||
|
||
const meta = { | ||
component: ContentMessage, | ||
args: { | ||
title: 'No items', | ||
text: 'No data available for this view', | ||
icon: IconInfo, | ||
}, | ||
argTypes: { | ||
icon: { | ||
options: ['None', 'Info', 'Warning', 'Error'], | ||
mapping: { | ||
None: undefined, | ||
Info: IconInfo, | ||
Warning: IconWarning, | ||
Error: IconError, | ||
}, | ||
control: { type: 'select' }, | ||
}, | ||
tone: { | ||
options: Object.values(Tone), | ||
control: { type: 'select' }, | ||
}, | ||
}, | ||
parameters: { | ||
docs: { | ||
page: () => ( | ||
<> | ||
<Title /> | ||
<Description /> | ||
<Subheading>Subcomponents</Subheading> | ||
It is composed of the following components, which can also be used | ||
separately for custom purposes: | ||
<ul> | ||
<li>ContentMessageContainer</li> | ||
<li>ContentMessageIcon</li> | ||
<li>ContentMessageTitle</li> | ||
<li>ContentMessageText</li> | ||
</ul> | ||
<Primary /> | ||
<Subheading>Props</Subheading> | ||
<Controls /> | ||
<Theme component="content" items={['message']} /> | ||
<Stories /> | ||
</> | ||
), | ||
}, | ||
}, | ||
} satisfies Meta<typeof ContentMessage> | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof ContentMessage> | ||
|
||
export const Default: Story = {} | ||
|
||
export const Tones: Story = { | ||
render: (args) => ( | ||
<div className="flex flex-row gap-2"> | ||
<ContentMessage {...args} tone={Tone.Primary} title="Primary" /> | ||
<ContentMessage {...args} tone={Tone.Informative} title="Informative" /> | ||
<ContentMessage {...args} tone={Tone.Success} title="Success" /> | ||
<ContentMessage {...args} tone={Tone.Warning} title="Warning" /> | ||
<ContentMessage {...args} tone={Tone.Critical} title="Critical" /> | ||
</div> | ||
), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.