feat(storybook): add a shared decorator for group rendering and static color settings
Description
Many storybook stories require adding layout and/or padding in order to view variants together or snapshot focus states. The goal of this PR is to unify this effort in a shared decorator that can be customized using a new customStorybookStyles object that is leveraged in a story's args settings.
Any settings added by the story will override these values. You can unset a value completely using undefined, i.e.:
customStorybookStyles: {
padding: undefined,
}
How and where has this been tested?
Please tag yourself on the tests you've marked complete to confirm the tests have been run by someone other than the author.
Validation steps
- [ ] Accordion: overrides padding settings to 0
Note: All values set by this decorator should appear as inline-styles assigned to the #root-inner element.
To-do list
- [x] I have read the contribution guidelines.
- [x] I have updated relevant storybook stories and templates.
- [x] If my change impacts other components, I have tested to make sure they don't break.
- [x] If my change impacts documentation, I have updated the documentation accordingly.
- [x] ✨ This pull request is ready to merge. ✨
@mdt2 Not 100% why PR #2398 closed and wouldn't re-open except that since I pulled some items out, maybe since one of them merged first it triggered a connection in git. All that to say, I re-opened this PR for review.
File metrics
Summary
Total size: 4.42 MB* Total change (Δ): ⬆ 0.13 KB (0.00%)
Table reports on changes to a package's main file. Other changes can be found in the collapsed Details section below.
| Package | Size | Δ |
|---|---|---|
| fieldgroup | 1.70 KB | ⬆ 0.04 KB |
Details
fieldgroup
| File | Head | Base | Δ |
|---|---|---|---|
| index-base.css | 1.70 KB | 1.65 KB | ⬆ 0.04 KB (2.48%) |
| index-vars.css | 1.70 KB | 1.65 KB | ⬆ 0.04 KB (2.48%) |
| index.css | 1.70 KB | 1.65 KB | ⬆ 0.04 KB (2.48%) |
| metadata.json | 0.88 KB | 0.88 KB | - |
* Results are not gzipped or minified.
* An ASCII character in UTF-8 is 8 bits or 1 byte.
🚀 Deployed on https://pr-2420--spectrum-css.netlify.app
layout: {
name: "Layout",
description: "How the buttons align in the preview (Storybook only).",
type: { name: "string" },
table: {
type: { summary: "string" },
category: "Advanced"
},
options: ["stacked","inline"],
control: "radio"
},
^ Love this approach from button introduced in #2248, maybe I should update this PR to use this instead or in addition-to?
⚠️ No Changeset found
Latest commit: 52b8560938cd7a971ecaba5b96dda600b0c20884
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR