Skip to content
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

chore: add storybook #1138

Merged
merged 5 commits into from
Sep 26, 2023
Merged

chore: add storybook #1138

merged 5 commits into from
Sep 26, 2023

Conversation

robinpyon
Copy link
Contributor

Description

This PR adds Storybook for local component development as we evaluate its usage for MVI-2 and beyond.

Things to note:

  • A small subset of primitive component stories have been created – we can look to migrate more over time if and when we're happy with Storybook.
  • All component stories have a default Docs story (the component with no required props) and surfaces all available props for usage
  • Inter has been added to both the manager (Storybook UI) and previews (the stories themselves)
    • We're still loading the version provided by the author, we'll need to swap this out for our own hosted version at some stage
  • Theme scheme (dark / light mode) toggles only apply to the stories themselves (not the entire interface)
  • All stories are wrapped with a common decorator which wraps stories in both a <ThemeProvider> but also a <Card> with padding
    • We may want to consider highlighting this, as usage of some props (e.g. muted on <Text> have no effect without a wrapping <Card>)
  • A separate 'Theme' section has been created, which also contains the current @sanity/color color spectrum story, which may be useful as a reference
  • stories/constants.ts defines a number of preconfigured Storybook controls which are imported in each story's meta definition. There may be a way to either obviate a lot of this via typing in future, or at the very least define these settings globally
  • ui-workshop usage and associated stories are unaffected

@vercel
Copy link

vercel bot commented Sep 19, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sanity-ui-workshop ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 26, 2023 10:36am

export default meta
type Story = StoryObj<typeof ColorScreen>

export const Overview: Story = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this story to be called Overview? could it simply be "Docs" ? And we get only on story generated for this file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question – I opted against "Docs" since this is a composite component (it's not exported and receives no props / has no controls).

It should probably be rendered as a page rather than a story, which might make this relationship a little more explicit in the sidebar?

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense, no need to change it.

Copy link
Contributor

@pedrobonamin pedrobonamin left a comment

Choose a reason for hiding this comment

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

I think this is great.
Pushed a PR adding a new story for tooltips to have a demo using play function inside the stories.
Will appreciate your thoughts in that #1139

Do you think we could have a README file in the root of storybook stories to indicate some of the findings that you discovered with the current implementation?

I think it's worth mentioning (some copied from your PR description)

  • Theme scheme (dark / light mode) toggles only apply to the stories themselves (not the entire interface)
  • All stories are wrapped with a common decorator which wraps stories in both a <ThemeProvider> but also a <Card> with padding
  • We may want to consider highlighting this, as usage of some props (e.g. muted on <Text> have no effect without a wrapping <Card>)
  • Not accepting to change titles in the export default of stories.
  • Folders structure.
  • Docs component behaviour

* chore: add tooltip story with play function

* fixup! chore: add tooltip story with play function
@socket-security
Copy link

New dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
storybook 7.4.5 None +12 13.4 MB shilman

@robinpyon robinpyon merged commit 52f8e84 into feat/facelift-mvi-2 Sep 26, 2023
@robinpyon robinpyon deleted the chore/storybook branch September 26, 2023 10:43
robinpyon added a commit that referenced this pull request Oct 10, 2023
* chore: add storybook

* chore: add tooltip story with play function (#1139)

* chore: add tooltip story with play function

* fixup! chore: add tooltip story with play function

* chore(storybook): add primitive stories, README, clean up storybook config, bump storybook deps

* fixup! chore(storybook): add primitive stories, README, clean up storybook config, bump storybook deps

* chore(storybook): update argType control overrides

---------

Co-authored-by: Pedro Bonamin <[email protected]>
mariuslundgard pushed a commit that referenced this pull request Nov 2, 2023
* chore: add storybook

* chore: add tooltip story with play function (#1139)

* chore: add tooltip story with play function

* fixup! chore: add tooltip story with play function

* chore(storybook): add primitive stories, README, clean up storybook config, bump storybook deps

* fixup! chore(storybook): add primitive stories, README, clean up storybook config, bump storybook deps

* chore(storybook): update argType control overrides

---------

Co-authored-by: Pedro Bonamin <[email protected]>
mariuslundgard pushed a commit that referenced this pull request Nov 7, 2023
* chore: add storybook

* chore: add tooltip story with play function (#1139)

* chore: add tooltip story with play function

* fixup! chore: add tooltip story with play function

* chore(storybook): add primitive stories, README, clean up storybook config, bump storybook deps

* fixup! chore(storybook): add primitive stories, README, clean up storybook config, bump storybook deps

* chore(storybook): update argType control overrides

---------

Co-authored-by: Pedro Bonamin <[email protected]>
mariuslundgard pushed a commit that referenced this pull request Dec 7, 2023
* chore: add storybook

* chore: add tooltip story with play function (#1139)

* chore: add tooltip story with play function

* fixup! chore: add tooltip story with play function

* chore(storybook): add primitive stories, README, clean up storybook config, bump storybook deps

* fixup! chore(storybook): add primitive stories, README, clean up storybook config, bump storybook deps

* chore(storybook): update argType control overrides

---------

Co-authored-by: Pedro Bonamin <[email protected]>
robinpyon added a commit that referenced this pull request Jan 16, 2024
* chore: add storybook

* chore: add tooltip story with play function (#1139)

* chore: add tooltip story with play function

* fixup! chore: add tooltip story with play function

* chore(storybook): add primitive stories, README, clean up storybook config, bump storybook deps

* fixup! chore(storybook): add primitive stories, README, clean up storybook config, bump storybook deps

* chore(storybook): update argType control overrides

---------

Co-authored-by: Pedro Bonamin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants