-
Notifications
You must be signed in to change notification settings - Fork 5
feat(tag): Improve knobs on component - FRONT-492 #334
Changes from 1 commit
d765f67
53627aa
50891e2
86ca246
f0094ab
a49fc97
6fd20fb
bccd212
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import merge from 'deepmerge'; | ||
import { storiesOf } from '@storybook/html'; | ||
import { withKnobs, text } from '@storybook/addon-knobs'; | ||
import { withKnobs, text, select } from '@storybook/addon-knobs'; | ||
import { withNotes } from '@ecl-twig/storybook-addon-notes'; | ||
import withCode from '@ecl-twig/storybook-addon-code'; | ||
|
||
|
@@ -11,6 +11,12 @@ import dataRemovable from './demo/data--removable'; | |
import tag from './ecl-tag.html.twig'; | ||
import notes from './README.md'; | ||
|
||
const variants = { | ||
'As a link': 'link', | ||
'As a Button': 'button', | ||
Removable: 'removable', | ||
}; | ||
|
||
storiesOf('Components/Tag', module) | ||
.addDecorator(withKnobs) | ||
.addDecorator(withNotes) | ||
|
@@ -23,7 +29,9 @@ storiesOf('Components/Tag', module) | |
tag: { | ||
label: text('Label', 'Link tag'), | ||
path: text('Url', '/example'), | ||
type: select('Variable', variants, 'link'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the purpose of having variants types as knobs if it's already defined as stories? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was literally the scope of the ticket to build in this functionality. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @papegaill , thanks for the review, your concern is clearly reasonable, this new select will let you switch between the different variants you have for the component which are indeed matching the stories we demo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @planctus I think it's confusing, because for example if on the "as a link" story i switch variant, I'm then able to set "url" on a button or a removable tag. same with parameter "aria-label" available only on removable tag. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, you convinced me, let's remove it ;) |
||
}, | ||
default_icon_path: defaultSprite, | ||
}) | ||
), | ||
{ | ||
|
@@ -37,6 +45,7 @@ storiesOf('Components/Tag', module) | |
merge(dataButton, { | ||
tag: { | ||
label: text('Label', 'Button tag'), | ||
type: select('Variable', variants, 'button'), | ||
}, | ||
}) | ||
), | ||
|
@@ -51,6 +60,8 @@ storiesOf('Components/Tag', module) | |
merge(dataRemovable, { | ||
tag: { | ||
label: text('Label', 'Removable tag'), | ||
type: select('Variable', variants, 'removable'), | ||
aria_label: text('Aria label', 'Dismiss'), | ||
}, | ||
default_icon_path: defaultSprite, | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing quotes to Removable?