Added stories for multiple components

Signed-off-by: Nitin Ramnani <nitin.ramnani@infosys.com>
This commit is contained in:
Nitin Ramnani
2024-05-03 14:52:20 +05:30
parent ae500129a9
commit baf298f57e
4 changed files with 82 additions and 69 deletions
@@ -18,34 +18,31 @@ import React from 'react';
import { HeaderIconLinkRow } from '../HeaderIconLinkRow';
import { IconLinkVerticalProps } from './IconLinkVertical';
type Props = {
links: IconLinkVerticalProps[];
};
export default {
title: 'Data Display/HeaderIconLinkRow',
component: HeaderIconLinkRow,
links: IconLinkVerticalProps[];
};
export default {
title: 'Data Display/HeaderIconLinkRow',
component: HeaderIconLinkRow,
};
export const Default = (args:Props) => <HeaderIconLinkRow {...args} />
export const Default = (args: Props) => <HeaderIconLinkRow {...args} />;
Default.args = {
links: [
{
color: 'primary',
disabled: false,
href: "https://google.com",
label: "primary",
title: "title"
},
{
color: 'secondary',
disabled: false,
href: "https://google.com",
label: "secondary",
title: "title-2"
},
]
};
links: [
{
color: 'primary',
disabled: false,
href: 'https://google.com',
label: 'primary',
title: 'title',
},
{
color: 'secondary',
disabled: false,
href: 'https://google.com',
label: 'secondary',
title: 'title-2',
},
],
};
@@ -19,20 +19,23 @@ import { ResponseErrorPanel } from '../ResponseErrorPanel';
import { ErrorPanelProps } from '../ErrorPanel';
export default {
title: 'Data Display/ResponseErrorPanel',
component: ResponseErrorPanel,
title: 'Data Display/ResponseErrorPanel',
component: ResponseErrorPanel,
};
export const Default = (args:ErrorPanelProps) => <ResponseErrorPanel {...args} />
export const Default = (args: ErrorPanelProps) => (
<ResponseErrorPanel {...args} />
);
Default.args = {
error: new Error('Error message from error object'),
defaultExpanded: false
error: new Error('Error message from error object'),
defaultExpanded: false,
};
export const WithTitle = (args:ErrorPanelProps) => <ResponseErrorPanel {...args} />
export const WithTitle = (args: ErrorPanelProps) => (
<ResponseErrorPanel {...args} />
);
WithTitle.args = {
error: new Error('test'),
defaultExpanded: false,
title:"Title prop is passed"
error: new Error('test'),
defaultExpanded: false,
title: 'Title prop is passed',
};
@@ -14,20 +14,18 @@
* limitations under the License.
*/
import React from 'react';
import { BottomLink } from '../BottomLink';
export default {
title: 'Layout/BottomLink',
component: BottomLink,
title: 'Layout/BottomLink',
component: BottomLink,
};
export const Default = (args:{
link:string
title:string
}) => <BottomLink {...args} />
export const Default = (args: { link: string; title: string }) => (
<BottomLink {...args} />
);
Default.args = {
link: 'https://google.com',
title: 'This is bottom link'
link: 'https://google.com',
title: 'This is bottom link',
};
@@ -14,45 +14,60 @@
* limitations under the License.
*/
import React , {ReactNode} from 'react';
import React, { ReactNode } from 'react';
import { ContentHeader } from '../ContentHeader';
export default {
title: 'Layout/ContentHeader',
component: ContentHeader,
title: 'Layout/ContentHeader',
component: ContentHeader,
};
type ContentHeaderProps = {
title?: string
titleComponent?: ReactNode;
description?: string;
textAlign?: 'left' | 'right' | 'center';
};
title?: string;
titleComponent?: ReactNode;
description?: string;
textAlign?: 'left' | 'right' | 'center';
};
export const Default = (args:ContentHeaderProps) => <ContentHeader {...args} ><div>Child of Content Header</div></ContentHeader>
export const Default = (args: ContentHeaderProps) => (
<ContentHeader {...args}>
<div>Child of Content Header</div>
</ContentHeader>
);
Default.args = {
title: 'This is Content Header default aligned',
description:'This is description'
title: 'This is Content Header default aligned',
description: 'This is description',
};
export const Left = (args:ContentHeaderProps) => <ContentHeader {...args} ><div>Child of Content Header</div></ContentHeader>
export const Left = (args: ContentHeaderProps) => (
<ContentHeader {...args}>
<div>Child of Content Header</div>
</ContentHeader>
);
Left.args = {
title: 'This is Content Header left aligned',
description:'This is description',
textAlign: 'left'
title: 'This is Content Header left aligned',
description: 'This is description',
textAlign: 'left',
};
export const Right = (args:ContentHeaderProps) => <ContentHeader {...args} ><div>Child of Content Header</div></ContentHeader>
export const Right = (args: ContentHeaderProps) => (
<ContentHeader {...args}>
<div>Child of Content Header</div>
</ContentHeader>
);
Right.args = {
title: 'This is Content Header right aligned',
description:'This is description',
textAlign: 'right'
title: 'This is Content Header right aligned',
description: 'This is description',
textAlign: 'right',
};
export const Center = (args:ContentHeaderProps) => <ContentHeader {...args} ><div>Child of Content Header</div></ContentHeader>
export const Center = (args: ContentHeaderProps) => (
<ContentHeader {...args}>
<div>Child of Content Header</div>
</ContentHeader>
);
Center.args = {
title: 'This is Content Header center aligned',
description:'This is description',
textAlign: 'center'
title: 'This is Content Header center aligned',
description: 'This is description',
textAlign: 'center',
};