Thanks to visit codestin.com
Credit goes to github.com

Skip to content

refactor: Add storybook + initial story #118

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

Merged
merged 7 commits into from
Feb 4, 2022

Conversation

bryphe-coder
Copy link
Contributor

This hooks up storybook, which the front-end team has enjoyed using in the v1 codebase - it makes it quick and easy to view and test components in isolation.

The <LoadingButton /> has a simple story added now, so if you run yarn storybook, you can preview it in various states:

2022-01-31 19 24 24

This will be helpful as we bring more front-end devs to help build v2 out.

@bryphe-coder bryphe-coder self-assigned this Feb 1, 2022
@codecov
Copy link

codecov bot commented Feb 1, 2022

Codecov Report

Merging #118 (4de9feb) into main (c65850b) will decrease coverage by 0.15%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #118      +/-   ##
==========================================
- Coverage   67.72%   67.57%   -0.16%     
==========================================
  Files         101      103       +2     
  Lines        5125     5132       +7     
  Branches       68       68              
==========================================
- Hits         3471     3468       -3     
- Misses       1343     1353      +10     
  Partials      311      311              
Flag Coverage Δ
unittest-go-macos-latest 64.51% <ø> (+0.07%) ⬆️
unittest-go-ubuntu-latest 66.67% <ø> (-0.27%) ⬇️
unittest-go-windows-latest ?
unittest-js 64.21% <0.00%> (-0.72%) ⬇️
Impacted Files Coverage Δ
site/.storybook/main.js 0.00% <0.00%> (ø)
site/.storybook/preview.js 0.00% <0.00%> (ø)
peer/channel.go 84.75% <0.00%> (-2.44%) ⬇️
provisionerd/provisionerd.go 73.30% <0.00%> (-0.98%) ⬇️
coderd/provisionerdaemons.go 48.28% <0.00%> (ø)
peer/conn.go 79.23% <0.00%> (+0.51%) ⬆️
peerbroker/listen.go 84.80% <0.00%> (+2.39%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c65850b...4de9feb. Read the comment docs.

package.json Outdated
@@ -12,13 +12,20 @@
"format:write": "prettier --write '**/*.{css,html,js,json,jsx,md,ts,tsx,yaml,yml}' && sql-formatter -l postgresql ./database/query.sql -o ./database/query.sql",
"lint": "jest --selectProjects lint",
"lint:fix": "FIX=true yarn lint",
"storybook": "start-storybook -p 6006 -s ./site/static",
Copy link
Member

Choose a reason for hiding this comment

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

Should we put storybook and the package.json inside of site? Seems a bit weird to have at the root now that I look, especially because npm run X competes with Makefile.

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, there was a blocker I ran into when I tried that on initially porting code over - due to differences in TypeScript compile requirements for nextjs and jest - different requirements for the jsx option. However turns it out wasn't too hard to fix in #128

I've now rebased this PR on top of that change so storybook lives completely in site now, too

bryphe-coder added a commit that referenced this pull request Feb 1, 2022
#128)

This refactors the front-end collateral to all live within `site` - so no `package.json` at the root.

The reason we had this initially is that the jest test run and NextJS actually require having _two_ different `tsconfig`s - Next needs `jsx:"preserve"`, while jest needs `jsx:"react"` - we were using `tsconfig`s at different levels at the hierarchy to manage this.

I changed this behavior to still use two different `tsconfig.json`s, which is mandatory - but just side-by-side in `site`.

Once that's fixed, it was easy to move everything into `site`

Follow up from: #118 (comment)
@bryphe-coder bryphe-coder force-pushed the bryphe/refactor/add-storybook branch from fc533b1 to f72ccb9 Compare February 1, 2022 22:48
@bryphe-coder bryphe-coder merged commit 94f71fe into main Feb 4, 2022
@bryphe-coder bryphe-coder deleted the bryphe/refactor/add-storybook branch February 4, 2022 16:36
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