NYCPlanning / design

A repository for the Design team in the Geographic Data and Engineering team of the NYC Department of City Planning.
1 stars 0 forks source link

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

Open jessicashanshanhuang opened 4 months ago

jessicashanshanhuang commented 4 months ago

Figuring out how to incorporate Storybook + Figma plug-in

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

streetscape repo my current branch

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

jessicashanshanhuang commented 4 months ago

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

jessicashanshanhuang commented 4 months ago

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.

storybook designs add on

we are using Storybook 7.6.20

for reference: workday's storybook design system, canvas

jessicashanshanhuang commented 4 months ago

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

Image

jessicashanshanhuang commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

newest commit has figspec implementation. to use, edit the .env file to include your personal figma token before running dev

jessicashanshanhuang commented 4 months ago

next steps:

questions: - will storybook version be upgraded anytime soon for streetscape?

jessicashanshanhuang commented 4 months ago

Design Token Plug-in

Syncing design tokens between figma + storybook

Display design token documentation generated from your stylesheets and icon files. Preview design token changes in the browser. Add your design tokens to your Storybook Docs pages using the custom Doc Blocks.

update: looking more into this, might not be the direct solution i want since it seems there's no direct link from figma to storybook relating design tokens

damonmcc commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

Design Token Automation

damonmcc commented 4 months ago

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 commented 4 months ago

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:

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 commented 4 months ago

updated markdown is in designs-plugin branch of our design repo! i will merge it to main soon after some small tweaks with formatting 🫡

jessicashanshanhuang commented 4 months ago

updated md is now in main of our design repo!

jessicashanshanhuang commented 4 months ago

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:

jessicashanshanhuang commented 4 months ago

running to an error trying to commit changes, most likely error is coming from npx lint-staged?

jessicashanshanhuang commented 4 months ago

figma chakra ui kit is now linked with storybook components!

published in latest commit in designs-plugin

Image

notes:

next steps: creating a shared personal access token

jessicashanshanhuang commented 4 months ago

update: shared figma access token on Design vault in 1Password, updated designs plug-in doc

@damonmcc will we need to rebase since designs-plugin branch in ae-streetscape are only two commits?

jessicashanshanhuang commented 4 months ago

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 commented 4 months ago

storybook v7 PR now ready to review

jessicashanshanhuang commented 3 months ago

Update: Storybook upgrade pr in review

jessicashanshanhuang commented 3 months ago

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