-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add Stories for o-banner demos #523
Conversation
32d8e81
to
4ac7c6d
Compare
Destroy Method: Adds a `destroy` method to o-banner. This is used in the o-banner Story to clean up the close button when re-rendered, which o-banner dynamically creates on `init`. This is required to support the `suppressCloseButton` Story control. Hidden Controls: It appears banner headings (headingLong/headingShort) should only be used with the small/compact layout variants. Not with the default banner style which is full bleed. However it is possible to use Story controls to create that view. `@storybook/addon-knobs` (deprecated) allowed dynamic knobs, so we could hide the heading controls if the default layout was selected. That's not possible with `@storybook/addon-controls`: storybookjs/storybook#11984 I think that's probably a good thing. Support for dynamic controls was worked on but not merge. It's a poor experience when controls shift around. storybookjs/storybook#13890 For now this commit hides the layout control on layout demos, and hides the heading controls from the default layout demo, to avoid showing the discouraged heading + layout combination. However it is still possible to select the base layout with heading on the theme specific demos, so that the small/compact layout can also be selected which is allowed. This could be resolved by exporting 2 templates, one for each kind of banner / usecase. This could make components easier to reason with and maintain. For now this commit sticks to one banner template as coming up with a name without history / useage guidelines is difficult, and we don't know that users aren't already using headings with the base layout - though we never intended it as far as I can tell. No Custom Theme Demo: The custom theme demo has not been migrated to a Story yet. https://registry.origami.ft.com/components/[email protected]#demo-custom-theme I'm not sure there is value, and maybe harm, in showing made up customised styles alongside those with brand/design approval. Plus it's not clear how to re-create the style without understanding Sass and inspecting demo code. We probably want to have stories for customised components at a later date, with improved guidelines around them and demo Sass/JS pane. See related issue: #370 No Custom Call To Action Demo: https://registry.origami.ft.com/components/[email protected]#demo-custom-call-to-action-layout The description of the demo starts "Although not recommended for design consistency..." Let's not recomend it with a demo.
4ac7c6d
to
234907b
Compare
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.
I've reviewed the changes and left a suggestion and some questions
I deployed this to a review app but it looks to not work due to lots of responses returning 404s -- https://origami-webs-stories-o--wn51ap.herokuapp.com/storybook/
...I deleted it, sorry |
As the "primaryAction" control is an object, it is not obvious to the user what options are available without a stand alone demo
Destroy Method
Adds a
destroy
method to o-banner. This is used in the o-bannerStory to clean up the close button when re-rendered, which o-banner
dynamically creates on
init
. This is required to support thesuppressCloseButton
Story control.Hidden Controls
It appears banner headings (headingLong/headingShort) should only
be used with the small/compact layout variants. Not with the default
banner style which is full bleed. However it is possible to use
Story controls to create that view.
ok: default layout story
![Screenshot 2022-01-10 at 15 00 07](https://user-images.githubusercontent.com/10405691/148793042-c4796720-1627-4fbd-af86-5281be7b977b.png)
bad: theme story, with layout changed to the default layout via a control
![Screenshot 2022-01-10 at 15 00 36](https://user-images.githubusercontent.com/10405691/148793034-208028bf-8c4b-4f4f-846f-04013d94b176.png)
(the default layout shouldn't be used with a heading)
@storybook/addon-knobs
(deprecated) allowed dynamic knobs,so we could hide the heading controls if the default layout
was selected. That's not possible with
@storybook/addon-controls
:storybookjs/storybook#11984
I think that's probably a good thing. Support for
dynamic controls was worked on but not merge. It's
a poor experience when controls shift around.
storybookjs/storybook#13890
For now this commit hides the layout control on layout
demos, and hides the heading controls from the default
layout demo, to avoid showing the discouraged
heading + layout combination. However it is still
possible to select the base layout with heading on the
theme specific demos, so that the small/compact layout
can also be selected which is allowed.
This could be resolved by exporting 2 templates, one
for each kind of banner / usecase. This could make
components easier to reason with and maintain. For
now this commit sticks to one banner template as
coming up with a name without history / useage
guidelines is difficult, and we don't know that
users aren't already using headings with the base
layout - though we never intended it as far as I
can tell.
No Custom Theme Demo
The custom theme demo has not been migrated to a Story
yet.
https://registry.origami.ft.com/components/[email protected]#demo-custom-theme
I'm not sure there is value, and maybe harm, in showing
made up customised styles alongside those with brand/design
approval. Plus it's not clear how to re-create the style
without understanding Sass and inspecting demo code.
We probably want to have stories for customised components
at a later date, with improved guidelines around them
and demo Sass/JS pane. See related issue:
#370
No Custom Call To Action Demo
https://registry.origami.ft.com/components/[email protected]#demo-custom-call-to-action-layout
The description of the demo starts "Although not recommended for
design consistency..." Let's not recomend it with a demo.