fix: storybook with typescript (#2926)
* fix storybook for typescript * fix babel
This commit is contained in:
parent
1b30ff83a5
commit
f9449e97df
@ -8,8 +8,10 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
plugins: [
|
plugins: [
|
||||||
'inline-react-svg',
|
'inline-react-svg',
|
||||||
'@babel/plugin-proposal-class-properties',
|
['@babel/plugin-proposal-class-properties', { loose: true }],
|
||||||
'@babel/plugin-transform-typescript',
|
'@babel/plugin-transform-typescript',
|
||||||
|
['@babel/plugin-proposal-private-property-in-object', { loose: true }],
|
||||||
|
['@babel/plugin-proposal-private-methods', { loose: true }],
|
||||||
],
|
],
|
||||||
env: {
|
env: {
|
||||||
test: {
|
test: {
|
||||||
|
|||||||
@ -66,6 +66,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.17.8",
|
"@babel/core": "^7.17.8",
|
||||||
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
||||||
|
"@babel/plugin-proposal-private-methods": "^7.18.6",
|
||||||
"@babel/plugin-proposal-object-rest-spread": "^7.17.3",
|
"@babel/plugin-proposal-object-rest-spread": "^7.17.3",
|
||||||
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
||||||
"@babel/plugin-transform-arrow-functions": "^7.16.7",
|
"@babel/plugin-transform-arrow-functions": "^7.16.7",
|
||||||
|
|||||||
@ -2,7 +2,11 @@ const path = require('path');
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
stories: ['../src/**/*.stories.@(mdx)'],
|
stories: ['../src/**/*.stories.@(mdx)'],
|
||||||
addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-google-analytics'],
|
addons: [
|
||||||
|
'@storybook/addon-links',
|
||||||
|
'@storybook/addon-essentials',
|
||||||
|
'@storybook/addon-google-analytics',
|
||||||
|
],
|
||||||
core: {
|
core: {
|
||||||
builder: 'webpack5',
|
builder: 'webpack5',
|
||||||
},
|
},
|
||||||
@ -11,11 +15,22 @@ module.exports = {
|
|||||||
// `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION'
|
// `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION'
|
||||||
// You can change the configuration based on that.
|
// You can change the configuration based on that.
|
||||||
// 'PRODUCTION' is used when building the static version of storybook.
|
// 'PRODUCTION' is used when building the static version of storybook.
|
||||||
|
|
||||||
// config.module.rules[0].use[0].options.plugins[1] = [
|
// config.module.rules[0].use[0].options.plugins[1] = [
|
||||||
// '@babel/plugin-proposal-class-properties',
|
// '@babel/plugin-proposal-class-properties',
|
||||||
// { loose: true },
|
// { loose: true },
|
||||||
// ];
|
// ];
|
||||||
|
|
||||||
|
// config.module.rules[0].use[0].options.plugins[3] = [
|
||||||
|
// '@babel/plugin-proposal-private-methods',
|
||||||
|
// { loose: true },
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// config.module.rules[0].use[0].options.plugins[4] = [
|
||||||
|
// '@babel/plugin-proposal-private-property-in-object',
|
||||||
|
// { loose: true },
|
||||||
|
// ];
|
||||||
|
|
||||||
// Make whatever fine-grained changes you need
|
// Make whatever fine-grained changes you need
|
||||||
config.module.rules.push({
|
config.module.rules.push({
|
||||||
test: /\.m?js/,
|
test: /\.m?js/,
|
||||||
@ -30,8 +45,6 @@ module.exports = {
|
|||||||
);
|
);
|
||||||
fileLoaderRule.exclude = /\.svg$/;
|
fileLoaderRule.exclude = /\.svg$/;
|
||||||
|
|
||||||
// console.log(JSON.stringify(config.module.rules, null, 2));
|
|
||||||
|
|
||||||
config.module.rules.push({
|
config.module.rules.push({
|
||||||
test: /\.svg$/,
|
test: /\.svg$/,
|
||||||
use: [
|
use: [
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { parameters } from '@storybook/addon-docs/dist/esm/frameworks/react/config';
|
import React from 'react';
|
||||||
import { addParameters } from '@storybook/react';
|
import { addParameters } from '@storybook/react';
|
||||||
import { DocsPage, DocsContainer } from '@storybook/addon-docs/blocks';
|
import { DocsPage, DocsContainer } from '@storybook/addon-docs';
|
||||||
import {
|
import {
|
||||||
Heading,
|
Heading,
|
||||||
SectionName,
|
SectionName,
|
||||||
@ -15,7 +15,6 @@ import './custom.css';
|
|||||||
// https://github.com/mondaycom/monday-ui-react-core/tree/master/.storybook
|
// https://github.com/mondaycom/monday-ui-react-core/tree/master/.storybook
|
||||||
addParameters({
|
addParameters({
|
||||||
docs: {
|
docs: {
|
||||||
...parameters.docs,
|
|
||||||
inlineStories: true,
|
inlineStories: true,
|
||||||
container: ({ children, context }) => (
|
container: ({ children, context }) => (
|
||||||
<DocsContainer context={context}>{children}</DocsContainer>
|
<DocsContainer context={context}>{children}</DocsContainer>
|
||||||
@ -20,7 +20,7 @@ export const aboutTemplate = args => (
|
|||||||
|
|
||||||
<Heading
|
<Heading
|
||||||
title="About Modal"
|
title="About Modal"
|
||||||
componentRelativePath="AboutModal/AboutModal.jsx"
|
componentRelativePath="AboutModal/AboutModal.tsx"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
|
|||||||
@ -14,22 +14,20 @@ export const argTypes = {
|
|||||||
|
|
||||||
export const buttonTemplate = createComponentTemplate(Button);
|
export const buttonTemplate = createComponentTemplate(Button);
|
||||||
|
|
||||||
<Heading title="Button" componentRelativePath="Button/Button.jsx"/>
|
<Heading title="Button" componentRelativePath="Button/Button.tsx" />
|
||||||
|
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
- [Props](#props)
|
- [Props](#props)
|
||||||
- [Usage](#usage)
|
- [Usage](#usage)
|
||||||
- [Contribute](#contribute)
|
- [Contribute](#contribute)
|
||||||
|
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
You can use the button component to create a button. It can be used in different ways, the default
|
You can use the button component to create a button. It can be used in different
|
||||||
button is a simple button with a text.
|
ways, the default button is a simple button with a text.
|
||||||
|
|
||||||
<Canvas>
|
<Canvas>
|
||||||
<Story name="Overview"
|
<Story name="Overview" args={{ children: 'Button', color: 'default' }}>
|
||||||
args={{children: "Button", color:"default"}}>
|
|
||||||
{buttonTemplate.bind({})}
|
{buttonTemplate.bind({})}
|
||||||
</Story>
|
</Story>
|
||||||
</Canvas>
|
</Canvas>
|
||||||
@ -39,13 +37,14 @@ button is a simple button with a text.
|
|||||||
<ArgsTable of={Button} />
|
<ArgsTable of={Button} />
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
### Variants
|
|
||||||
There can be different variants of buttons: `text`, `outlined`,
|
|
||||||
`contained`, and `disabled`.
|
|
||||||
|
|
||||||
|
### Variants
|
||||||
|
|
||||||
|
There can be different variants of buttons: `text`, `outlined`, `contained`, and
|
||||||
|
`disabled`.
|
||||||
|
|
||||||
<Canvas>
|
<Canvas>
|
||||||
<Story name="Variants" >
|
<Story name="Variants">
|
||||||
<div className="flex space-x-2">
|
<div className="flex space-x-2">
|
||||||
<Button variant="text">Text Button</Button>
|
<Button variant="text">Text Button</Button>
|
||||||
<Button variant="outlined">Outlined Button</Button>
|
<Button variant="outlined">Outlined Button</Button>
|
||||||
@ -55,13 +54,13 @@ There can be different variants of buttons: `text`, `outlined`,
|
|||||||
</Story>
|
</Story>
|
||||||
</Canvas>
|
</Canvas>
|
||||||
|
|
||||||
|
|
||||||
### Colors
|
### Colors
|
||||||
There are different colors for the button: `default`, `primary`, `secondary`, `white`, `black`, `inherit`, `light`.
|
|
||||||
|
|
||||||
|
There are different colors for the button: `default`, `primary`, `secondary`,
|
||||||
|
`white`, `black`, `inherit`, `light`.
|
||||||
|
|
||||||
<Canvas>
|
<Canvas>
|
||||||
<Story name="Colors" >
|
<Story name="Colors">
|
||||||
<div className="flex space-x-2">
|
<div className="flex space-x-2">
|
||||||
<Button color="default">Default Button</Button>
|
<Button color="default">Default Button</Button>
|
||||||
<Button color="primary">Primary Button</Button>
|
<Button color="primary">Primary Button</Button>
|
||||||
@ -75,96 +74,105 @@ There are different colors for the button: `default`, `primary`, `secondary`, `w
|
|||||||
</Canvas>
|
</Canvas>
|
||||||
|
|
||||||
### Mixing props
|
### Mixing props
|
||||||
|
|
||||||
You can mix different props together to create a button.
|
You can mix different props together to create a button.
|
||||||
|
|
||||||
<Canvas>
|
<Canvas>
|
||||||
<Story name="Custom" >
|
<Story name="Custom">
|
||||||
<Button color="secondary" variant="outlined">Custom Button</Button>
|
<Button color="secondary" variant="outlined">
|
||||||
|
Custom Button
|
||||||
|
</Button>
|
||||||
</Story>
|
</Story>
|
||||||
</Canvas>
|
</Canvas>
|
||||||
|
|
||||||
### Disabled
|
### Disabled
|
||||||
|
|
||||||
You can disable the button by setting the variant to `disabled`.
|
You can disable the button by setting the variant to `disabled`.
|
||||||
|
|
||||||
<Canvas>
|
<Canvas>
|
||||||
<Story name="Disabled" >
|
<Story name="Disabled">
|
||||||
<Button variant="disabled">Disabled Button</Button>
|
<Button variant="disabled">Disabled Button</Button>
|
||||||
</Story>
|
</Story>
|
||||||
</Canvas>
|
</Canvas>
|
||||||
|
|
||||||
|
|
||||||
### Start/End Icons
|
### Start/End Icons
|
||||||
|
|
||||||
You can add an icon to the start of the button. It accepts an icon component.
|
You can add an icon to the start of the button. It accepts an icon component.
|
||||||
|
|
||||||
|
|
||||||
<Canvas>
|
<Canvas>
|
||||||
<Story name="Start Icon" >
|
<Story name="Start Icon">
|
||||||
{() => {
|
{() => {
|
||||||
// svg icon for github
|
// svg icon for github
|
||||||
const Github = () => {
|
const Github = () => {
|
||||||
return (
|
return (
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="24"
|
||||||
height="24"
|
height="24"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
strokeWidth="2"
|
strokeWidth="2"
|
||||||
strokeLinecap="round"
|
strokeLinecap="round"
|
||||||
strokeLinejoin="round"
|
strokeLinejoin="round"
|
||||||
className="feather feather-github"
|
className="feather feather-github"
|
||||||
>
|
>
|
||||||
<path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"></path>
|
<path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"></path>
|
||||||
</svg>
|
</svg>
|
||||||
)
|
);
|
||||||
}
|
};
|
||||||
return <Button startIcon={<Github />}>Start Icon Button</Button>;
|
return <Button startIcon={<Github />}>Start Icon Button</Button>;
|
||||||
}}
|
}}
|
||||||
}}
|
}}
|
||||||
</Story>
|
</Story>
|
||||||
</Canvas>
|
</Canvas>
|
||||||
|
|
||||||
End Icon is the same as start icon, but for the end of the button.
|
End Icon is the same as start icon, but for the end of the button.
|
||||||
|
|
||||||
|
|
||||||
<Canvas>
|
<Canvas>
|
||||||
<Story name="End Icon" >
|
<Story name="End Icon">
|
||||||
{() => {
|
{() => {
|
||||||
// svg icon for github
|
// svg icon for github
|
||||||
const Github = () => {
|
const Github = () => {
|
||||||
return (
|
return (
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="24"
|
||||||
height="24"
|
height="24"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
strokeWidth="2"
|
strokeWidth="2"
|
||||||
strokeLinecap="round"
|
strokeLinecap="round"
|
||||||
strokeLinejoin="round"
|
strokeLinejoin="round"
|
||||||
className="feather feather-github"
|
className="feather feather-github"
|
||||||
>
|
>
|
||||||
<path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"></path>
|
<path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"></path>
|
||||||
</svg>
|
</svg>
|
||||||
)
|
);
|
||||||
}
|
};
|
||||||
return <Button startIcon={<Github />} endIcon={<Github />}>Start and End Icon Button</Button>;
|
return (
|
||||||
}}
|
<Button startIcon={<Github />} endIcon={<Github />}>
|
||||||
|
Start and End Icon Button
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
}}
|
||||||
}}
|
}}
|
||||||
</Story>
|
</Story>
|
||||||
</Canvas>
|
</Canvas>
|
||||||
|
|
||||||
|
|
||||||
### Full width
|
### Full width
|
||||||
|
|
||||||
You can make the button full width by setting the `fullWidth` prop to `true`.
|
You can make the button full width by setting the `fullWidth` prop to `true`.
|
||||||
|
|
||||||
<Canvas>
|
<Canvas>
|
||||||
<Story name="Full Width" >
|
<Story name="Full Width">
|
||||||
<Button fullWidth color="secondary">Full Width Button</Button>
|
<Button fullWidth color="secondary">
|
||||||
|
Full Width Button
|
||||||
|
</Button>
|
||||||
</Story>
|
</Story>
|
||||||
</Canvas>
|
</Canvas>
|
||||||
|
|
||||||
## Contribute
|
## Contribute
|
||||||
<Footer componentRelativePath="Button/__stories__/button.stories.mdx"/>
|
|
||||||
|
<Footer componentRelativePath="Button/__stories__/button.stories.mdx" />
|
||||||
|
|||||||
@ -23,7 +23,7 @@ export const buttonGroupTemplate = args => (
|
|||||||
|
|
||||||
<Heading
|
<Heading
|
||||||
title="ButtonGroup"
|
title="ButtonGroup"
|
||||||
componentRelativePath="ButtonGroup/ButtonGroup.jsx"
|
componentRelativePath="ButtonGroup/ButtonGroup.tsx"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
|
|||||||
@ -11,7 +11,7 @@ export const argTypes = {
|
|||||||
|
|
||||||
export const cineTemplate = createComponentTemplate(CinePlayer);
|
export const cineTemplate = createComponentTemplate(CinePlayer);
|
||||||
|
|
||||||
<Heading title="CinePlayer" componentRelativePath="CinePlayer/CinePlayer.jsx" />
|
<Heading title="CinePlayer" componentRelativePath="CinePlayer/CinePlayer.tsx" />
|
||||||
|
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
- [Props](#props)
|
- [Props](#props)
|
||||||
|
|||||||
@ -13,7 +13,7 @@ export const contextMenueTemplate = createComponentTemplate(ContextMenu);
|
|||||||
|
|
||||||
<Heading
|
<Heading
|
||||||
title="ContextMenu"
|
title="ContextMenu"
|
||||||
componentRelativePath="ContextMenu/ContextMenu.jsx"
|
componentRelativePath="ContextMenu/ContextMenu.tsx"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
@ -34,7 +34,7 @@ on user right click.
|
|||||||
{
|
{
|
||||||
label: 'Delete measurement',
|
label: 'Delete measurement',
|
||||||
actionType: 'Delete',
|
actionType: 'Delete',
|
||||||
action: (item) => {
|
action: item => {
|
||||||
window.alert(`${item.label} clicked`);
|
window.alert(`${item.label} clicked`);
|
||||||
},
|
},
|
||||||
value: {},
|
value: {},
|
||||||
@ -42,7 +42,7 @@ on user right click.
|
|||||||
{
|
{
|
||||||
label: 'Add Label',
|
label: 'Add Label',
|
||||||
actionType: 'setLabel',
|
actionType: 'setLabel',
|
||||||
action: (item) => {
|
action: item => {
|
||||||
window.alert(`${item.label} clicked`);
|
window.alert(`${item.label} clicked`);
|
||||||
},
|
},
|
||||||
value: {},
|
value: {},
|
||||||
|
|||||||
@ -8,13 +8,13 @@ export const argTypes = {
|
|||||||
|
|
||||||
<Meta title="Components/DateRange" component={DateRange} />
|
<Meta title="Components/DateRange" component={DateRange} />
|
||||||
|
|
||||||
export const DateRangeTemplate = (args) => (
|
export const DateRangeTemplate = args => (
|
||||||
<div className="h-96">
|
<div className="h-96">
|
||||||
<DateRange {...args} />
|
<DateRange {...args} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
<Heading title="DateRange" componentRelativePath="DateRange/DateRange.jsx" />
|
<Heading title="DateRange" componentRelativePath="DateRange/DateRange.tsx" />
|
||||||
|
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
- [Props](#props)
|
- [Props](#props)
|
||||||
|
|||||||
@ -11,7 +11,7 @@ export const argTypes = {
|
|||||||
|
|
||||||
export const DialogTemplate = createComponentTemplate(Dialog);
|
export const DialogTemplate = createComponentTemplate(Dialog);
|
||||||
|
|
||||||
<Heading title="Dialog" componentRelativePath="Dialog/Dialog.jsx" />
|
<Heading title="Dialog" componentRelativePath="Dialog/Dialog.tsx" />
|
||||||
|
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
- [Props](#props)
|
- [Props](#props)
|
||||||
|
|||||||
@ -9,14 +9,14 @@ export const argTypes = {
|
|||||||
|
|
||||||
<Meta title="Components/Dropdown" component={Dropdown} />
|
<Meta title="Components/Dropdown" component={Dropdown} />
|
||||||
|
|
||||||
export const DropdownTemplate = (args) => (
|
export const DropdownTemplate = args => (
|
||||||
// Todo: this should not set a background
|
// Todo: this should not set a background
|
||||||
<div className="flex h-32">
|
<div className="flex h-32">
|
||||||
<Dropdown {...args} />
|
<Dropdown {...args} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
<Heading title="Dropdown" componentRelativePath="Dropdown/Dropdown.jsx" />
|
<Heading title="Dropdown" componentRelativePath="Dropdown/Dropdown.tsx" />
|
||||||
|
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
- [Props](#props)
|
- [Props](#props)
|
||||||
|
|||||||
@ -11,7 +11,7 @@ export const argTypes = {
|
|||||||
|
|
||||||
export const HeaderTemplate = createComponentTemplate(Header);
|
export const HeaderTemplate = createComponentTemplate(Header);
|
||||||
|
|
||||||
<Heading title="Header" componentRelativePath="Header/Header.jsx" />
|
<Heading title="Header" componentRelativePath="Header/Header.tsx" />
|
||||||
|
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
- [Props](#props)
|
- [Props](#props)
|
||||||
|
|||||||
@ -11,14 +11,14 @@ export const argTypes = {
|
|||||||
|
|
||||||
<Meta title="Components/Icon" component={Icon} />
|
<Meta title="Components/Icon" component={Icon} />
|
||||||
|
|
||||||
export const IconTemplate = (args) => (
|
export const IconTemplate = args => (
|
||||||
// Todo: Icon colors
|
// Todo: Icon colors
|
||||||
<div className="w-8 h-8">
|
<div className="w-8 h-8">
|
||||||
<Icon {...args} />
|
<Icon {...args} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
<Heading title="Icon" componentRelativePath="Icon/Icon.jsx" />
|
<Heading title="Icon" componentRelativePath="Icon/Icon.tsx" />
|
||||||
|
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
- [Props](#props)
|
- [Props](#props)
|
||||||
@ -56,8 +56,8 @@ icons.
|
|||||||
return (
|
return (
|
||||||
<div className="flex flex-wrap">
|
<div className="flex flex-wrap">
|
||||||
{icons
|
{icons
|
||||||
.filter((ic) => ic !== 'magnifier')
|
.filter(ic => ic !== 'magnifier')
|
||||||
.map((icon) => (
|
.map(icon => (
|
||||||
<div className="m-4 flex flex-col justify-center items-center">
|
<div className="m-4 flex flex-col justify-center items-center">
|
||||||
<div class="w-8 h-8">
|
<div class="w-8 h-8">
|
||||||
<Icon name={icon} />
|
<Icon name={icon} />
|
||||||
|
|||||||
@ -12,7 +12,7 @@ export const argTypes = {
|
|||||||
|
|
||||||
export const InputTemplate = createComponentTemplate(Input);
|
export const InputTemplate = createComponentTemplate(Input);
|
||||||
|
|
||||||
<Heading title="Input" componentRelativePath="Input/Input.jsx" />
|
<Heading title="Input" componentRelativePath="Input/Input.tsx" />
|
||||||
|
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
- [Props](#props)
|
- [Props](#props)
|
||||||
|
|||||||
@ -14,7 +14,7 @@ export const LayoutSelectorTemplate = createComponentTemplate(LayoutSelector);
|
|||||||
|
|
||||||
<Heading
|
<Heading
|
||||||
title="LayoutSelector"
|
title="LayoutSelector"
|
||||||
componentRelativePath="LayoutSelector/LayoutSelector.jsx"
|
componentRelativePath="LayoutSelector/LayoutSelector.tsx"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
|
|||||||
@ -10,7 +10,7 @@ export const argTypes = {
|
|||||||
|
|
||||||
<Meta title="Components/MeasurementTable" component={MeasurementTable} />
|
<Meta title="Components/MeasurementTable" component={MeasurementTable} />
|
||||||
|
|
||||||
export const MeasurementTableTemplate = (args) => (
|
export const MeasurementTableTemplate = args => (
|
||||||
<div className="w-64 h-64 bg-primary-dark">
|
<div className="w-64 h-64 bg-primary-dark">
|
||||||
<MeasurementTable {...args} />
|
<MeasurementTable {...args} />
|
||||||
</div>
|
</div>
|
||||||
@ -18,7 +18,7 @@ export const MeasurementTableTemplate = (args) => (
|
|||||||
|
|
||||||
<Heading
|
<Heading
|
||||||
title="MeasurementTable"
|
title="MeasurementTable"
|
||||||
componentRelativePath="MeasurementTable/MeasurementTable.jsx"
|
componentRelativePath="MeasurementTable/MeasurementTable.tsx"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
|
|||||||
@ -14,7 +14,7 @@ export const NotificationTemplate = createComponentTemplate(Notification);
|
|||||||
|
|
||||||
<Heading
|
<Heading
|
||||||
title="Notification"
|
title="Notification"
|
||||||
componentRelativePath="Notification/Notification.jsx"
|
componentRelativePath="Notification/Notification.tsx"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
|
|||||||
@ -10,7 +10,7 @@ export const argTypes = {
|
|||||||
|
|
||||||
<Meta title="Components/SegmentationTable" component={SegmentationTable} />
|
<Meta title="Components/SegmentationTable" component={SegmentationTable} />
|
||||||
|
|
||||||
export const SegmentationTableTemplate = (args) => (
|
export const SegmentationTableTemplate = args => (
|
||||||
<div className="w-64 h-96 bg-primary-dark">
|
<div className="w-64 h-96 bg-primary-dark">
|
||||||
<SegmentationTable {...args} />
|
<SegmentationTable {...args} />
|
||||||
</div>
|
</div>
|
||||||
@ -18,7 +18,7 @@ export const SegmentationTableTemplate = (args) => (
|
|||||||
|
|
||||||
<Heading
|
<Heading
|
||||||
title="SegmentationTable"
|
title="SegmentationTable"
|
||||||
componentRelativePath="SegmentationTable/SegmentationTable.jsx"
|
componentRelativePath="SegmentationTable/SegmentationTable.tsx"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
|
|||||||
@ -10,13 +10,13 @@ export const argTypes = {
|
|||||||
|
|
||||||
<Meta title="Components/SidePanel" component={SidePanel} />
|
<Meta title="Components/SidePanel" component={SidePanel} />
|
||||||
|
|
||||||
export const SidePanelTemplate = (args) => (
|
export const SidePanelTemplate = args => (
|
||||||
<div className="w-96">
|
<div className="w-96">
|
||||||
<SidePanel {...args} />
|
<SidePanel {...args} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
<Heading title="SidePanel" componentRelativePath="SidePanel/SidePanel.jsx" />
|
<Heading title="SidePanel" componentRelativePath="SidePanel/SidePanel.tsx" />
|
||||||
|
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
- [Props](#props)
|
- [Props](#props)
|
||||||
|
|||||||
@ -10,7 +10,7 @@ export const argTypes = {
|
|||||||
|
|
||||||
<Meta title="Components/SplitButton" component={SplitButton} />
|
<Meta title="Components/SplitButton" component={SplitButton} />
|
||||||
|
|
||||||
export const SplitButtonTemplate = (args) => (
|
export const SplitButtonTemplate = args => (
|
||||||
<div className="h-32 bg-primary-dark">
|
<div className="h-32 bg-primary-dark">
|
||||||
<SplitButton {...args} />
|
<SplitButton {...args} />
|
||||||
</div>
|
</div>
|
||||||
@ -18,7 +18,7 @@ export const SplitButtonTemplate = (args) => (
|
|||||||
|
|
||||||
<Heading
|
<Heading
|
||||||
title="SplitButton"
|
title="SplitButton"
|
||||||
componentRelativePath="SplitButton/SplitButton.jsx"
|
componentRelativePath="SplitButton/SplitButton.tsx"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
|
|||||||
@ -10,7 +10,7 @@ export const argTypes = {
|
|||||||
|
|
||||||
<Meta title="Components/StudyBrowser" component={StudyBrowser} />
|
<Meta title="Components/StudyBrowser" component={StudyBrowser} />
|
||||||
|
|
||||||
export const StudyBrowserTemplate = (args) => (
|
export const StudyBrowserTemplate = args => (
|
||||||
<div className="w-96">
|
<div className="w-96">
|
||||||
<StudyBrowser {...args} />
|
<StudyBrowser {...args} />
|
||||||
</div>
|
</div>
|
||||||
@ -18,7 +18,7 @@ export const StudyBrowserTemplate = (args) => (
|
|||||||
|
|
||||||
<Heading
|
<Heading
|
||||||
title="StudyBrowser"
|
title="StudyBrowser"
|
||||||
componentRelativePath="StudyBrowser/StudyBrowser.jsx"
|
componentRelativePath="StudyBrowser/StudyBrowser.tsx"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
|
|||||||
@ -10,13 +10,13 @@ export const argTypes = {
|
|||||||
|
|
||||||
<Meta title="Components/StudyItem" component={StudyItem} />
|
<Meta title="Components/StudyItem" component={StudyItem} />
|
||||||
|
|
||||||
export const StudyItemTemplate = (args) => (
|
export const StudyItemTemplate = args => (
|
||||||
<div className="w-96">
|
<div className="w-96">
|
||||||
<StudyItem {...args} />
|
<StudyItem {...args} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
<Heading title="StudyItem" componentRelativePath="StudyItem/StudyItem.jsx" />
|
<Heading title="StudyItem" componentRelativePath="StudyItem/StudyItem.tsx" />
|
||||||
|
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
- [Props](#props)
|
- [Props](#props)
|
||||||
|
|||||||
@ -1,22 +1,22 @@
|
|||||||
import Viewport from "../Viewport";
|
import Viewport from '../Viewport';
|
||||||
|
|
||||||
import { ArgsTable, Story, Canvas, Meta } from "@storybook/addon-docs";
|
import { ArgsTable, Story, Canvas, Meta } from '@storybook/addon-docs';
|
||||||
import { createComponentTemplate } from "../../../storybook/functions/create-component-story";
|
import { createComponentTemplate } from '../../../storybook/functions/create-component-story';
|
||||||
|
|
||||||
export const argTypes = {
|
export const argTypes = {
|
||||||
component: Viewport,
|
component: Viewport,
|
||||||
title: "Components/Viewport",
|
title: 'Components/Viewport',
|
||||||
};
|
};
|
||||||
|
|
||||||
<Meta title="Components/Viewport" component={Viewport} />
|
<Meta title="Components/Viewport" component={Viewport} />
|
||||||
|
|
||||||
export const ViewportTemplate = (args) => (
|
export const ViewportTemplate = args => (
|
||||||
<div className="h-40 bg-primary-dark">
|
<div className="h-40 bg-primary-dark">
|
||||||
<Viewport {...args} />
|
<Viewport {...args} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
<Heading title="Viewport" componentRelativePath="Viewport/Viewport.jsx" />
|
<Heading title="Viewport" componentRelativePath="Viewport/Viewport.tsx" />
|
||||||
|
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
- [Props](#props)
|
- [Props](#props)
|
||||||
@ -31,25 +31,25 @@ Viewport is a component that renders the Viewport action bar.
|
|||||||
name="Overview"
|
name="Overview"
|
||||||
args={{
|
args={{
|
||||||
viewportIndex: 0,
|
viewportIndex: 0,
|
||||||
onSeriesChange: (direction) => alert(`Annotation ${direction}`),
|
onSeriesChange: direction => alert(`Annotation ${direction}`),
|
||||||
studyData: {
|
studyData: {
|
||||||
label: "A",
|
label: 'A',
|
||||||
isTracked: true,
|
isTracked: true,
|
||||||
isLocked: false,
|
isLocked: false,
|
||||||
isRehydratable: false,
|
isRehydratable: false,
|
||||||
studyDate: "07-Sep-2011",
|
studyDate: '07-Sep-2011',
|
||||||
currentSeries: 1,
|
currentSeries: 1,
|
||||||
seriesDescription:
|
seriesDescription:
|
||||||
"Series description lorem ipsum dolor sit Series description lorem ipsum dolor sit Series description lorem ipsum dolor sit ",
|
'Series description lorem ipsum dolor sit Series description lorem ipsum dolor sit Series description lorem ipsum dolor sit ',
|
||||||
modality: "CT",
|
modality: 'CT',
|
||||||
patientInformation: {
|
patientInformation: {
|
||||||
patientName: "Smith, Jane",
|
patientName: 'Smith, Jane',
|
||||||
patientSex: "F",
|
patientSex: 'F',
|
||||||
patientAge: "59",
|
patientAge: '59',
|
||||||
MRN: "10000001",
|
MRN: '10000001',
|
||||||
thickness: "5.0mm",
|
thickness: '5.0mm',
|
||||||
spacing: "1.25mm",
|
spacing: '1.25mm',
|
||||||
scanner: "Aquilion",
|
scanner: 'Aquilion',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
|
|||||||
@ -38,7 +38,7 @@ for each color.
|
|||||||
Therefore you can use the className to style the color of a component (using
|
Therefore you can use the className to style the color of a component (using
|
||||||
`bg-${color-class}`) or text (using `text-${color-class}`).
|
`bg-${color-class}`) or text (using `text-${color-class}`).
|
||||||
|
|
||||||
```jsx
|
```tsx
|
||||||
<div className="bg-primary-main text-primary-light">OHIF UI Components</div>
|
<div className="bg-primary-main text-primary-light">OHIF UI Components</div>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@ -66,8 +66,8 @@ error. Always check the code block when you get an error.
|
|||||||
For instance the following code block will generate the error (notice the extra
|
For instance the following code block will generate the error (notice the extra
|
||||||
vertical space in the code block):
|
vertical space in the code block):
|
||||||
|
|
||||||
```jsx
|
```tsx
|
||||||
export const TooltipTemplate = (args) => (
|
export const TooltipTemplate = args => (
|
||||||
<div className="h-16 w-full">
|
<div className="h-16 w-full">
|
||||||
<div class="w-8 h-8 mx-auto">
|
<div class="w-8 h-8 mx-auto">
|
||||||
<Tooltip {...args}>
|
<Tooltip {...args}>
|
||||||
@ -91,7 +91,7 @@ stories with the same name, it will cause an error.
|
|||||||
|
|
||||||
The following code block will generate an error:
|
The following code block will generate an error:
|
||||||
|
|
||||||
```jsx
|
```tsx
|
||||||
<Canvas>
|
<Canvas>
|
||||||
<Story name="Variants">
|
<Story name="Variants">
|
||||||
<Typography variant="h1" color="initial">
|
<Typography variant="h1" color="initial">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user