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

refactor(menu): improve stories snippet parsing #1942

Merged
merged 1 commit into from
Oct 13, 2022

Conversation

baptisteArno
Copy link
Contributor

Summary

No need to parse custom code snippets anymore.

Type

  • Refactor

@baptisteArno baptisteArno added the enhancement New feature or request label Oct 11, 2022
@baptisteArno baptisteArno self-assigned this Oct 11, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Oct 11, 2022

size-limit report 📦

Path Size
dist/src/index.js, dist/react-datepicker/dist/react-datepicker.min.css.js, dist/react-toastify/dist/ReactToastify.min.css.js, dist/src/helpers/isJSON.js, dist/src/helpers/legend.js, dist/src/helpers/numbers.js, dist/src/helpers/recursivelyGetChildrenString.js, dist/src/theme/index.js, dist/src/utils/animations.js, dist/src/utils/capitalize.js, dist/src/utils/ids.js, dist/src/utils/normalize.js, dist/src/utils/orderBy.js, dist/src/components/ActionBar/index.js, dist/src/components/Alert/index.js, dist/src/components/Avatar/index.js, dist/src/components/Badge/index.js, dist/src/components/BarChart/Tooltip.js, dist/src/components/BarChart/index.js, dist/src/components/BarStack/index.js, dist/src/components/BorderedBox/index.js, dist/src/components/Box/index.js, dist/src/components/Breadcrumbs/index.js, dist/src/components/Bullet/index.js, dist/src/components/Button/index.js, dist/src/components/Checkbox/index.js, dist/src/components/Container/index.js, dist/src/components/DateInput/index.js, dist/src/components/Description/index.js, dist/src/components/DotSteps/index.js, dist/src/components/Expandable/index.js, dist/src/components/Grid/Col.js, dist/src/components/Grid/Grid.js, dist/src/components/Grid/Row.js, dist/src/components/Icon/index.js, dist/src/components/Image/index.js, dist/src/components/Label/index.js, dist/src/components/LineChart/CustomLegend.js, dist/src/components/LineChart/Tooltip.js, dist/src/components/LineChart/helpers.js, dist/src/components/LineChart/index.js, dist/src/components/Link/index.js, dist/src/components/List/Cell.js, dist/src/components/List/LoadingPlaceholder.js, dist/src/components/List/SelectBar.js, dist/src/components/List/SortIcon.js, dist/src/components/List/context.js, dist/src/components/List/index.js, dist/src/components/Loader/index.js, dist/src/components/MarkDown/index.js, dist/src/components/Menu/Item.js, dist/src/components/Menu/index.js, dist/src/components/Modal/index.js, dist/src/components/NavigationStepper/index.js, dist/src/components/Notice/index.js, dist/src/components/Pagination/getPageNumbers.js, dist/src/components/Pagination/index.js, dist/src/components/Pagination/usePagination.js, dist/src/components/PaginationV2/getPageNumbers.js, dist/src/components/PaginationV2/index.js, dist/src/components/PasswordCheck/index.js, dist/src/components/PasswordStrengthMeter/index.js, dist/src/components/Pentagon/index.js, dist/src/components/PieChart/Legends.js, dist/src/components/PieChart/Tooltip.js, dist/src/components/PieChart/index.js, dist/src/components/PieChart/patterns.js, dist/src/components/Placeholder/Block.js, dist/src/components/Placeholder/Blocks.js, dist/src/components/Placeholder/BoxWithIcon.js, dist/src/components/Placeholder/Donut.js, dist/src/components/Placeholder/IconPlaceholder.js, dist/src/components/Placeholder/Line.js, dist/src/components/Placeholder/List.js, dist/src/components/Placeholder/Slider.js, dist/src/components/Placeholder/index.js, dist/src/components/ProgressBar/index.js, dist/src/components/ProgressionButton/index.js, dist/src/components/Radio/index.js, dist/src/components/RichSelect/index.js, dist/src/components/ScrollView/index.js, dist/src/components/SelectNumber/index.js, dist/src/components/SelectableCard/index.js, dist/src/components/Separator/index.js, dist/src/components/Slider/index.js, dist/src/components/Sphere/index.js, dist/src/components/Stack/index.js, dist/src/components/StateBar/index.js, dist/src/components/Status/index.js, dist/src/components/StealthCopiable/index.js, dist/src/components/StepList/index.js, dist/src/components/Stepper/index.js, dist/src/components/SwitchButton/FocusOverlay.js, dist/src/components/SwitchButton/index.js, dist/src/components/Table/index.js, dist/src/components/Tabs/Tab.js, dist/src/components/Tabs/TabMenu.js, dist/src/components/Tabs/TabMenuItem.js, dist/src/components/Tabs/TabsContext.js, dist/src/components/Tabs/index.js, dist/src/components/Tag/index.js, dist/src/components/Tags/index.js, dist/src/components/TagsPoplist/index.js, dist/src/components/Text/index.js, dist/src/components/TextBox/index.js, dist/src/components/TimeInput/index.js, dist/src/components/Toaster/index.js, dist/src/components/Toggle/index.js, dist/src/components/Tooltip/helpers.js, dist/src/components/Tooltip/index.js, dist/src/components/TooltipIcon/index.js, dist/src/components/Touchable/index.js, dist/src/components/UnitInput/index.js, dist/src/components/VerificationCode/index.js, dist/src/components/VolumeSize/index.js, dist/src/theme/tokens/dark.js, dist/src/theme/tokens/light.js, dist/src/utils/responsive/Breakpoint.js, dist/src/utils/responsive/utilities.js, dist/src/components/List/variants/index.js, dist/src/components/List/variants/variantExplorer.js, dist/src/components/List/variants/variantProduct.js, dist/src/components/List/variants/variantTable.js 121.16 KB (0%)

@codecov
Copy link

codecov bot commented Oct 11, 2022

Codecov Report

Merging #1942 (e9a46fd) into main (46388b1) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1942   +/-   ##
=======================================
  Coverage   95.20%   95.20%           
=======================================
  Files         122      122           
  Lines        3043     3043           
  Branches      427      427           
=======================================
  Hits         2897     2897           
  Misses        111      111           
  Partials       35       35           
Impacted Files Coverage Δ
src/components/Menu/index.tsx 100.00% <ø> (ø)

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 46388b1...e9a46fd. Read the comment docs.

@baptisteArno baptisteArno marked this pull request as draft October 11, 2022 09:04
@baptisteArno baptisteArno force-pushed the refactor/improve-menu-stories branch from 2dc84a6 to e9a46fd Compare October 11, 2022 09:16
@baptisteArno baptisteArno marked this pull request as ready for review October 11, 2022 09:16
Copy link
Collaborator

@matthprost matthprost left a comment

Choose a reason for hiding this comment

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

Screenshot 2022-10-12 at 11 09 42

In the code snippet we have function brackets, is it supposed to be like that ?

@baptisteArno
Copy link
Contributor Author

In the code snippet we have function brackets, is it supposed to be like that ?

@matthprost yes, I better understand how story parsing is done. Now we never have to write custom snippet.

If you give your ComponentStory a function argument, then Storybook will set the source type to dynamic. If you don't give an argument, it will set the source type to code.

The dynamic source type will try to "understand" the inner component. But for complex story it will not render something useful

The code source type is just printing out your component as-is, with the function brackets included (I couldn't find a way to ignore those)

More info: https://storybook.js.org/docs/react/writing-docs/doc-block-source

@baptisteArno baptisteArno merged commit 3605862 into main Oct 13, 2022
@baptisteArno baptisteArno deleted the refactor/improve-menu-stories branch October 13, 2022 07:49
scaleway-bot pushed a commit that referenced this pull request Oct 17, 2022
## [0.199.3](v0.199.2...v0.199.3) (2022-10-17)

### ⚡ Refactor

* **expandable:** remove box ([#1945](#1945)) ([2011cec](2011cec))
* **menu:** improve stories snippet parsing ([#1942](#1942)) ([3605862](3605862))

### 📦 Chore

* **devdeps:** update actions/cache action to v3.0.11 ([#1957](#1957)) ([7902165](7902165))
* **devdeps:** update actions/setup-node action to v3.5.1 ([#1958](#1958)) ([8361139](8361139))
* **devdeps:** update dependency @scaleway/eslint-config-react to v3.7.6 ([#1955](#1955)) ([3b5c2b0](3b5c2b0))
* **devdeps:** update dependency next-transpile-modules to v9.1.0 ([#1952](#1952)) ([823b613](823b613))
* **devdeps:** update docker/build-push-action action to v3.2.0 ([#1953](#1953)) ([f5aa0db](f5aa0db))
* **devdeps:** update docker/login-action action to v2.1.0 ([#1954](#1954)) ([5eef0e2](5eef0e2))

### 📝 Documentation

* fix description not display in storybook ([#1960](#1960)) ([5ba8a87](5ba8a87))

### 🐛 Bug Fixes

* **verification-code:** add classname ([#1963](#1963)) ([4495ba6](4495ba6))
@scaleway-bot
Copy link
Collaborator

🎉 This PR is included in version 0.199.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants