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

DS: Figure out Storybook + Figma designs plug-in #28

Open
jessicashanshanhuang opened this issue Jun 28, 2024 · 24 comments · May be fixed by NYCPlanning/ae-streetscape#66
Open

DS: Figure out Storybook + Figma designs plug-in #28

jessicashanshanhuang opened this issue Jun 28, 2024 · 24 comments · May be fixed by NYCPlanning/ae-streetscape#66
Assignees

Comments

@jessicashanshanhuang
Copy link
Contributor

jessicashanshanhuang commented Jun 28, 2024

Figuring out how to incorporate Storybook + Figma plug-in

  • could help streamline design tokens a lot faster
  • need to understand what it is capable of

Currently: prepping pull request to merge design plugin changes to main

  • let's start off with a simpler component from scratch (button?)

streetscape repo
my current branch

Important

Currently using designs-plugin branch, for documentation, check out designs plug in guide in design repo

@jessicashanshanhuang jessicashanshanhuang self-assigned this Jun 28, 2024
@jessicashanshanhuang
Copy link
Contributor Author

jessicashanshanhuang commented Jun 28, 2024

Background on Storybook and how components work

Why components should be used

what is a story

A story captures the rendered state of a UI component, there are example components that has a set of stories that show the states it supports (Button, Header, Page).

how to create a new story

  • i can create stories (states) but can i create my own component outside of the example ones?
  • seems like AE is currently using components from Chakra UI and then editing the stories in storybook
  • looks like i am able to create template components: how to write stories, subcomponents and templates

template component: it means you can more easily reuse the args to each story in a composite component. It also means that you can alter the args to the component with the Controls addon

  • so it looks like the composite component is what i want to manipulate

There are two basic levels of organization in Storybook: the component and its child stories. Think of each story as a permutation of a component. You can have as many stories per component as you need.

@jessicashanshanhuang
Copy link
Contributor Author

jessicashanshanhuang commented Jul 5, 2024

Storybook + Figma Compatibility

storybook + figma, how it works

The design addon for Storybook allows you to embed Figma files alongside your code-based components in Storybook. Meanwhile, the Storybook plugin for Figma allows you to embed stories alongside your design components in Figma.

  • is chromatic automatically installed with our stories?

storybook designs add on

we are using Storybook 7.6.20

for reference: workday's storybook design system, canvas

@jessicashanshanhuang
Copy link
Contributor Author

was able to get the figma file to embed through design panel on a test button in storybook

Image

@jessicashanshanhuang
Copy link
Contributor Author

so looks like i am now able to embed figma files into storybook so when a user uses storybook to build a ui component, they can have a live design there.

the next step is to see if i can get the figspec compatibility to work which would allow someone to view the design token specs for the figma design within storybook

@jessicashanshanhuang
Copy link
Contributor Author

jessicashanshanhuang commented Jul 5, 2024

got figspec to work, however unable to push changes to my branch since it does use my figma personal access token and github blocked the push (can bypass if i choose to unblock the secret)

Image

@jessicashanshanhuang

This comment has been minimized.

@jessicashanshanhuang

This comment has been minimized.

@jessicashanshanhuang

This comment has been minimized.

@damonmcc
Copy link
Member

damonmcc commented Jul 9, 2024

to get npm install to work, I had to drop "@storybook/blocks": "^7.4.1", from package.json

will storybook version be upgraded anytime soon for streetscape?

seems worth trying in ur branch!

@damonmcc
Copy link
Member

damonmcc commented Jul 9, 2024

related to the .env, here are two examples of how AE handles that:

you should probably change it to sample.env and add .env to the file .gitignore

@jessicashanshanhuang
Copy link
Contributor Author

to get npm install to work, I had to drop "@storybook/blocks": "^7.4.1", from package.json

will storybook version be upgraded anytime soon for streetscape?

seems worth trying in ur branch!

sounds good! i think for figma designs plug in i didn't really run into that issue but i am currently running to issues with the design token plug ins so i'll see it that fixes that!

@jessicashanshanhuang
Copy link
Contributor Author

Design Token Automation

  • involves github sync with figma which requires a github personal access token
  • need to look into more to see how to implement the pipeline

@damonmcc
Copy link
Member

Design Token Automation

  • involves github sync with figma which requires a github personal access token
  • need to look into more to see how to implement the pipeline

@jessicashanshanhuang happy to help with that!

if other significant parts of Storybook + Figma compatibility are working though, might be nice to document/finalize those and break out token automation into it's own issue?

but if tokens are already an integral part of the DS in figma, could totally see why token automation should be an expectation of Storybook + Figma compatibility!

@jessicashanshanhuang
Copy link
Contributor Author

jessicashanshanhuang commented Jul 10, 2024

Outcome

The storybook designs plug-in is implemented in the testing-figma-plugin branch, we are currently running the plug-in for storybook v7. The plug-in is capable of the following:

  • able to now access figma wireframes and components through embedded figma file within storybook. when storybook is launch, click on storybook component, and click on the design section where the figma file lives
  • able to inspect for css elements in the embedded figma file, use change figma parameter in your the respective storybook components stories tsx file to figspec and add personal figma access token in the sample.env file
  • able to access figma prototypes within storybook through embedded figma file that shows the preview version of the prototype. Access the same way by going to a storybook component and clicking on the design section.

Next Steps:
I will write a markdown on how to install and use the storybook designs plug in, potentially it will live in the design repo for now.

Next, we will explore the design token automation pipeline to sync simultaneously update design tokens between figma and storybook. Discussion related to this will be in a new git issue.

@jessicashanshanhuang jessicashanshanhuang changed the title DS: Figure out Storybook + Figma compatibility plug-in DS: Figure out Storybook + Figma designs plug-in Jul 10, 2024
@jessicashanshanhuang

This comment has been minimized.

@jessicashanshanhuang
Copy link
Contributor Author

updated md is now in main of our design repo!

@jessicashanshanhuang
Copy link
Contributor Author

jessicashanshanhuang commented Jul 15, 2024

reopened to initiate pull request for ae-streetscape

Note

the following changes will be on a new branch, designs-plugin in ae-streetscape

to-do:

  • link chakra ui kit components from figma to their respective storybook components
  • considering how a shared figma personal access token might simplify their use of the plugin
  • update designs plug-in documentation in design repo
  • rebase to reduce number of commits
  • comply with Conventional Commits requirement

@jessicashanshanhuang

This comment has been minimized.

@jessicashanshanhuang
Copy link
Contributor Author

jessicashanshanhuang commented Jul 15, 2024

figma chakra ui kit is now linked with storybook components!

published in latest commit in designs-plugin

Image

notes:

  • will need to update the chakra ui kit to latest version and apply our styling we currently are curating in streetscape
  • seems like current chakra ui kit from figma is from 2021? might need to do some research about current chakra tho not necessary for this pr
  • linked almost every component, accordion did not have a respective figma component in our current figma chakra ui kit, the drawer seems to be wip for ae, some buttons do not have a link since they are more customize and doesn't seem to have a direct counterpart in figma

next steps: creating a shared personal access token

@jessicashanshanhuang

This comment has been minimized.

@jessicashanshanhuang
Copy link
Contributor Author

jessicashanshanhuang commented Jul 16, 2024

PR initiated, waiting on review!

update: looks like there's some dependency issues, will debug

update 2: looks like we have some peer dependency issues, damon and i plan to create two prs: one to upgrade storybook to latest v7 and another to include the design plug with our upgraded version

@jessicashanshanhuang
Copy link
Contributor Author

jessicashanshanhuang commented Jul 18, 2024

storybook v7 PR now ready to review

@jessicashanshanhuang

This comment has been minimized.

@damonmcc damonmcc linked a pull request Aug 7, 2024 that will close this issue
@jessicashanshanhuang
Copy link
Contributor Author

Update: Storybook v7 Pr merged, last step is to finish up draft pr for designs plug-in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants