Skip to content

Commit

Permalink
Breadcrumb stories description & defaultValue -- clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
g-stamatis committed Jan 14, 2022
1 parent 879b640 commit 186ab65
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { Breadcrumb } from 'semantic-ui-react';

export default {
title: 'Components/Breadcrumb/Breadcrumb 2',
title: 'Components/Breadcrumb',
component: Breadcrumb,
parameters: {
actions: {
Expand All @@ -13,25 +13,63 @@ export default {
icon: {
control: { type: 'select' },
options: ['right chevron', 'right arrow', 'caret right'],
description:"breadcrumb divider icon",
table:{
type:{
summary:"string"
},
defaultValue: {
summary: 'right chevron',
},
}
},
size: {
control: { type: 'select' },
options: ['mini', 'tiny', 'small', 'large', 'big', 'huge', 'massive'],
description:"breadcrumb size",
table:{
type:{
summary:"string"
},
defaultValue: {
summary: 'small',
},
}
},
sections:{
description:"breadcrumb tabs",
table:{
type:{
summary:"Object"
},
defaultValue: {
summary: ' \""\ '
},
}
}
},
};

//const Template = (args) => <Breadcrumb {...args}></Breadcrumb>;

const Template = (args) =>
<Breadcrumb size={args.size}>
{args.sections.map((section,index) => (
<>
<Breadcrumb.Section key={section.key} link={section.link} active={index === args.sections.length - 1}>{section.content} </Breadcrumb.Section>
{index !== args.sections.length - 1 && <Breadcrumb.Divider icon={`${args.icon}`} />}
</>
))}
</Breadcrumb>;
const Template = (args) => (
<Breadcrumb size={args.size}>
{args.sections.map((section, index) => (
<>
<Breadcrumb.Section
key={section.key}
link={section.link}
active={index === args.sections.length - 1}
>
{section.content}{' '}
</Breadcrumb.Section>
{index !== args.sections.length - 1 && (
<Breadcrumb.Divider icon={`${args.icon}`} />
)}
</>
))}
</Breadcrumb>
);

export const Default = Template.bind({});
Default.args = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export const Breadcrumb = injectIntl(({ children, ...args }) => {
);
});

export default {
title: 'Components/Breadcrumb/Breadcrumb 1',
component: Breadcrumb,
argTypes: {},
};
// export default {
// title: 'Components/Breadcrumb/Breadcrumb 1',
// component: Breadcrumb,
// argTypes: {},
// };

0 comments on commit 186ab65

Please sign in to comment.