Skip to content

feat(storybook): custom properties panel #3166

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

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

castastrophe
Copy link
Collaborator

@castastrophe castastrophe commented Sep 26, 2024

Description

Adds a new custom properties panel to the development preview pages for each component that surfaces the modifiable custom properties as sourced from the metadata/metadata.json file (note that this is not a live updated list because metadata.json is not generated by storybook).

This panel allows a visitor to put in their own values and see how it impacts the styling of the component in the view panel.

Screenshot 2024-09-26 at 12 39 46 PM

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

  • Visit the Accordion storybook, expect to see the CSS Custom Properties panel
  • Click the panel and add a custom color to the --mod-accordion-background-color-default entry; expect to see the background color of the accordion to update live.

To-do list

  • I have read the contribution guidelines.
  • I have updated relevant storybook stories and templates.
  • If my change impacts documentation, I have updated the documentation accordingly.
  • ✨ This pull request is ready to merge. ✨

Copy link

changeset-bot bot commented Sep 26, 2024

🦋 Changeset detected

Latest commit: 0dbf6f1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@spectrum-css/generator Patch
@spectrum-css/preview Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@castastrophe castastrophe force-pushed the feat-storybook-custom-properties-panel branch 3 times, most recently from 2ed616c to e1f7a95 Compare September 26, 2024 16:28
@castastrophe castastrophe self-assigned this Sep 26, 2024
@castastrophe castastrophe added skip_vrt Add to a PR to skip running VRT (but still pass the action) storybook s1 labels Sep 26, 2024
Copy link
Contributor

github-actions bot commented Sep 26, 2024

🚀 Deployed on https://pr-3166--spectrum-css.netlify.app

@castastrophe castastrophe force-pushed the feat-storybook-custom-properties-panel branch from e1f7a95 to 27b6165 Compare September 26, 2024 16:53
Copy link
Contributor

github-actions bot commented Sep 26, 2024

File metrics

Summary

Total size: 2.24 MB*

🎉 No changes detected in any packages

* Size is the sum of all main files for packages in the library.
* An ASCII character in UTF-8 is 8 bits or 1 byte.

@castastrophe castastrophe force-pushed the feat-storybook-custom-properties-panel branch 7 times, most recently from 754b512 to 59656d1 Compare September 27, 2024 00:34
@castastrophe castastrophe force-pushed the feat-storybook-custom-properties-panel branch from 59656d1 to 4c2f600 Compare October 23, 2024 19:30
@castastrophe castastrophe force-pushed the feat-storybook-custom-properties-panel branch from 4c2f600 to d497927 Compare November 1, 2024 19:15
@castastrophe castastrophe force-pushed the feat-storybook-custom-properties-panel branch from d497927 to 82d2f9e Compare December 6, 2024 14:05
@castastrophe castastrophe changed the base branch from main to s2-foundations-redux December 6, 2024 14:05
@castastrophe castastrophe force-pushed the feat-storybook-custom-properties-panel branch 3 times, most recently from e66a6ff to df9d5cc Compare December 12, 2024 14:31
@castastrophe castastrophe force-pushed the s2-foundations-redux branch 2 times, most recently from 2eebf01 to 711d4cd Compare December 16, 2024 23:49
@castastrophe castastrophe force-pushed the feat-storybook-custom-properties-panel branch from df9d5cc to ff03881 Compare December 17, 2024 01:52
@castastrophe castastrophe force-pushed the main branch 10 times, most recently from c68f4e3 to d2272ea Compare March 12, 2025 21:56
@castastrophe castastrophe force-pushed the feat-storybook-custom-properties-panel branch 3 times, most recently from 15b85cf to 4d403a2 Compare March 25, 2025 13:29
@@ -25,6 +25,7 @@ export const AssetListItem = ({
isBranch = false,
onclick = () => {},
} = {}, context = {}) => html`
${when(styles, () => html`<style>${styles}</style>`)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <no-undef> reported by reviewdog 🐶
'styles' is not defined.

@@ -25,6 +25,7 @@
isBranch = false,
onclick = () => {},
} = {}, context = {}) => html`
${when(styles, () => html`<style>${styles}</style>`)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <no-undef> reported by reviewdog 🐶
'styles' is not defined.

@@ -6,6 +6,11 @@ import packageJson from "../package.json";
import { CheckboxGroup } from "./checkbox.test.js";
import { AllVariantsCheckboxGroup, DocsCheckboxGroup, Template } from "./template.js";

// Local assets to render the component styles and structure
import styles from "../index.css?inline";
import metadata from "../dist/metadata.json";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] reported by reviewdog 🐶
Parsing error: Identifier 'metadata' has already been declared

@castastrophe castastrophe force-pushed the feat-storybook-custom-properties-panel branch 3 times, most recently from b5079ad to 4653ea4 Compare March 31, 2025 19:34
castastrophe and others added 12 commits April 4, 2025 10:03
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* docs(assetcard): remove MDX file

- adds some missing documentation regarding stories, classes and custom
properties
- corrects sentence-casing of story names

* docs(avatar): remove MDX file

- adds some missing documentation regarding stories
- reorganizes some information to sit with appropriate story/variant
- migrates documentation from MDX file to the stories file instead

* chore(avatar): fix disabled test arguments

* docs(badge): remove MDX file

- adds notice badge variants to semantic story
- adds sizing story to docs page
- migrates documentation in MDX to stories.js instead

* docs(badge): pr fixes

- remove empty doc block line
- remove html wrapper in favor of content array
- add notice badge to test coverage
Expanding the existing themes system to support the new S2 mappings.

---
Co-authored-by: castastrophe <[email protected]>
Co-authored-by: Patrick Fulton <[email protected]>
Co-authored-by: Cory Dransfeldt <[email protected]>
Co-authored-by: Aziz Ramos <[email protected]>
Co-authored-by: Josh Winn <[email protected]>
Co-authored-by: Rise Erpelding <[email protected]>
Co-authored-by: Marissa Huysentruyt <[email protected]>
Co-authored-by: Rajdeep Chandra <[email protected]>
Co-authored-by: TarunAdobe <[email protected]>
Co-authored-by: Dragan Eror<[email protected]>
Expanding the existing themes system to support the new S2 mappings.

---
Co-authored-by: castastrophe <[email protected]>
Co-authored-by: Patrick Fulton <[email protected]>
Co-authored-by: Cory Dransfeldt <[email protected]>
Co-authored-by: Aziz Ramos <[email protected]>
Co-authored-by: Josh Winn <[email protected]>
Co-authored-by: Rise Erpelding <[email protected]>
Co-authored-by: Marissa Huysentruyt <[email protected]>
Co-authored-by: Rajdeep Chandra <[email protected]>
Co-authored-by: TarunAdobe <[email protected]>
Co-authored-by: Dragan Eror<[email protected]>
@castastrophe castastrophe force-pushed the feat-storybook-custom-properties-panel branch from 4653ea4 to 0dbf6f1 Compare April 4, 2025 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S2 Spectrum 2 skip_vrt Add to a PR to skip running VRT (but still pass the action) storybook
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants