chore(react-components): Theme picker for storybook --docs mode - #20448
Merged
Conversation
Chromatic stores published storybooks with commits, we can simply build an azure function to keep the version -> commit mapping and integrate a picker into the docs page
Adds the theme picker to the storybook toolbar for internal development. The global types are exported since they will be used for the docs page.
Initialize a custom `FluentDocsContainer` and FluentDocsHeader` to the react-components storybook for future toolbar items like theme and version picker. This custom header is required since our future plans to build with `--docs` will remove the native storybook toolbar
ling1726
commented
Nov 2, 2021
Collaborator
📊 Bundle size reportUnchanged fixtures
|
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: 77492e6095e4ed5e8e5c168d506cb035dc956323 (build) |
ling1726
commented
Nov 2, 2021
| return useStorybookGlobals(); | ||
| } | ||
|
|
||
| export function setGlobalTheme(themeId: string): void { |
Contributor
Author
There was a problem hiding this comment.
I thought that exporting this was clearner than using the storybook channels and messages directly in react-components. Open to push back for this
ling1726
marked this pull request as ready for review
November 2, 2021 15:04
Collaborator
Perf Analysis (
|
| Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
|---|---|---|---|---|---|
| Avatar | mount | 1002 | 958 | 5000 | |
| BaseButton | mount | 1010 | 1005 | 5000 | |
| Breadcrumb | mount | 2899 | 2703 | 1000 | |
| ButtonNext | mount | 557 | 619 | 5000 | |
| Checkbox | mount | 1635 | 1671 | 5000 | |
| CheckboxBase | mount | 1409 | 1364 | 5000 | |
| ChoiceGroup | mount | 5059 | 5160 | 5000 | |
| ComboBox | mount | 998 | 1006 | 1000 | |
| CommandBar | mount | 10327 | 10573 | 1000 | |
| ContextualMenu | mount | 6573 | 6476 | 1000 | |
| DefaultButton | mount | 1238 | 1215 | 5000 | |
| DetailsRow | mount | 4188 | 3990 | 5000 | |
| DetailsRowFast | mount | 4065 | 3942 | 5000 | |
| DetailsRowNoStyles | mount | 3815 | 3838 | 5000 | |
| Dialog | mount | 2690 | 2712 | 1000 | |
| DocumentCardTitle | mount | 181 | 179 | 1000 | |
| Dropdown | mount | 3355 | 3347 | 5000 | |
| FluentProviderNext | mount | 3743 | 3779 | 5000 | |
| FluentProviderWithTheme | mount | 228 | 223 | 10 | |
| FluentProviderWithTheme | virtual-rerender | 95 | 87 | 10 | |
| FluentProviderWithTheme | virtual-rerender-with-unmount | 258 | 263 | 10 | |
| FocusTrapZone | mount | 1837 | 1843 | 5000 | |
| FocusZone | mount | 1741 | 1784 | 5000 | |
| IconButton | mount | 1868 | 1890 | 5000 | |
| Label | mount | 356 | 351 | 5000 | |
| Layer | mount | 3056 | 3145 | 5000 | |
| Link | mount | 499 | 498 | 5000 | |
| MakeStyles | mount | 1755 | 1798 | 50000 | |
| MenuButton | mount | 1672 | 1639 | 5000 | |
| MessageBar | mount | 2043 | 2036 | 5000 | |
| Nav | mount | 3493 | 3504 | 1000 | |
| OverflowSet | mount | 1104 | 1143 | 5000 | |
| Panel | mount | 2605 | 2561 | 1000 | |
| Persona | mount | 889 | 896 | 1000 | |
| Pivot | mount | 1493 | 1472 | 1000 | |
| PrimaryButton | mount | 1399 | 1369 | 5000 | |
| Rating | mount | 8329 | 8320 | 5000 | |
| SearchBox | mount | 1458 | 1433 | 5000 | |
| Shimmer | mount | 2772 | 2747 | 5000 | |
| Slider | mount | 2055 | 2206 | 5000 | |
| SpinButton | mount | 5296 | 5346 | 5000 | |
| Spinner | mount | 448 | 434 | 5000 | |
| SplitButton | mount | 3316 | 3328 | 5000 | |
| Stack | mount | 537 | 544 | 5000 | |
| StackWithIntrinsicChildren | mount | 1800 | 1838 | 5000 | |
| StackWithTextChildren | mount | 5119 | 5063 | 5000 | |
| SwatchColorPicker | mount | 11019 | 11455 | 5000 | |
| TagPicker | mount | 2759 | 2820 | 5000 | |
| TeachingBubble | mount | 12941 | 13244 | 5000 | |
| Text | mount | 477 | 459 | 5000 | |
| TextField | mount | 1493 | 1471 | 5000 | |
| ThemeProvider | mount | 1178 | 1227 | 5000 | |
| ThemeProvider | virtual-rerender | 615 | 611 | 5000 | |
| ThemeProvider | virtual-rerender-with-unmount | 2009 | 2029 | 5000 | |
| Toggle | mount | 864 | 857 | 5000 | |
| buttonNative | mount | 149 | 125 | 5000 |
Perf Analysis (@fluentui/react-northstar)
Perf tests with no regressions
| Scenario | Current PR Ticks | Baseline Ticks | Ratio |
|---|---|---|---|
| ButtonMinimalPerf.default | 207 | 188 | 1.1:1 |
| ChatDuplicateMessagesPerf.default | 337 | 311 | 1.08:1 |
| IconMinimalPerf.default | 705 | 653 | 1.08:1 |
| ListNestedPerf.default | 636 | 602 | 1.06:1 |
| HeaderSlotsPerf.default | 843 | 800 | 1.05:1 |
| ListMinimalPerf.default | 564 | 539 | 1.05:1 |
| PortalMinimalPerf.default | 181 | 173 | 1.05:1 |
| RadioGroupMinimalPerf.default | 498 | 476 | 1.05:1 |
| ReactionMinimalPerf.default | 434 | 412 | 1.05:1 |
| SegmentMinimalPerf.default | 378 | 361 | 1.05:1 |
| VideoMinimalPerf.default | 696 | 663 | 1.05:1 |
| AccordionMinimalPerf.default | 171 | 164 | 1.04:1 |
| AlertMinimalPerf.default | 313 | 300 | 1.04:1 |
| AttachmentMinimalPerf.default | 185 | 178 | 1.04:1 |
| AttachmentSlotsPerf.default | 1159 | 1112 | 1.04:1 |
| FlexMinimalPerf.default | 302 | 291 | 1.04:1 |
| FormMinimalPerf.default | 473 | 453 | 1.04:1 |
| ImageMinimalPerf.default | 420 | 405 | 1.04:1 |
| RefMinimalPerf.default | 245 | 236 | 1.04:1 |
| StatusMinimalPerf.default | 770 | 741 | 1.04:1 |
| BoxMinimalPerf.default | 386 | 374 | 1.03:1 |
| LabelMinimalPerf.default | 418 | 405 | 1.03:1 |
| LayoutMinimalPerf.default | 403 | 391 | 1.03:1 |
| ListWith60ListItems.default | 706 | 687 | 1.03:1 |
| LoaderMinimalPerf.default | 738 | 717 | 1.03:1 |
| CustomToolbarPrototype.default | 4330 | 4222 | 1.03:1 |
| ToolbarMinimalPerf.default | 1036 | 1004 | 1.03:1 |
| AnimationMinimalPerf.default | 440 | 431 | 1.02:1 |
| CardMinimalPerf.default | 601 | 591 | 1.02:1 |
| CarouselMinimalPerf.default | 513 | 502 | 1.02:1 |
| DatepickerMinimalPerf.default | 5847 | 5731 | 1.02:1 |
| DropdownManyItemsPerf.default | 743 | 730 | 1.02:1 |
| EmbedMinimalPerf.default | 4501 | 4397 | 1.02:1 |
| HeaderMinimalPerf.default | 408 | 401 | 1.02:1 |
| ItemLayoutMinimalPerf.default | 1304 | 1281 | 1.02:1 |
| PopupMinimalPerf.default | 607 | 595 | 1.02:1 |
| SplitButtonMinimalPerf.default | 4658 | 4548 | 1.02:1 |
| TableManyItemsPerf.default | 2057 | 2018 | 1.02:1 |
| TextAreaMinimalPerf.default | 590 | 577 | 1.02:1 |
| ChatMinimalPerf.default | 692 | 684 | 1.01:1 |
| CheckboxMinimalPerf.default | 2815 | 2798 | 1.01:1 |
| DialogMinimalPerf.default | 800 | 796 | 1.01:1 |
| DividerMinimalPerf.default | 389 | 387 | 1.01:1 |
| DropdownMinimalPerf.default | 3223 | 3185 | 1.01:1 |
| GridMinimalPerf.default | 362 | 360 | 1.01:1 |
| InputMinimalPerf.default | 1388 | 1376 | 1.01:1 |
| MenuMinimalPerf.default | 888 | 877 | 1.01:1 |
| ProviderMergeThemesPerf.default | 1715 | 1696 | 1.01:1 |
| SkeletonMinimalPerf.default | 388 | 384 | 1.01:1 |
| SliderMinimalPerf.default | 1764 | 1750 | 1.01:1 |
| TableMinimalPerf.default | 422 | 418 | 1.01:1 |
| TreeMinimalPerf.default | 859 | 852 | 1.01:1 |
| AvatarMinimalPerf.default | 201 | 201 | 1:1 |
| ButtonOverridesMissPerf.default | 1865 | 1871 | 1:1 |
| MenuButtonMinimalPerf.default | 1771 | 1778 | 1:1 |
| TooltipMinimalPerf.default | 1129 | 1125 | 1:1 |
| ButtonSlotsPerf.default | 590 | 603 | 0.98:1 |
| ProviderMinimalPerf.default | 1177 | 1196 | 0.98:1 |
| TextMinimalPerf.default | 357 | 366 | 0.98:1 |
| ChatWithPopoverPerf.default | 401 | 414 | 0.97:1 |
| ListCommonPerf.default | 695 | 724 | 0.96:1 |
| TreeWith60ListItems.default | 191 | 200 | 0.96:1 |
| RosterPerf.default | 1274 | 1390 | 0.92:1 |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 94c5687:
|
Hotell
approved these changes
Nov 4, 2021
GeoffCox
approved these changes
Nov 4, 2021
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
layershifter
reviewed
Nov 5, 2021
mlp73
pushed a commit
to mlp73/fluentui
that referenced
this pull request
Jan 17, 2022
…crosoft#20448) * experiment(storybook): Version picker Chromatic stores published storybooks with commits, we can simply build an azure function to keep the version -> commit mapping and integrate a picker into the docs page * Change files * use fluent menu * cleanup * add network fetch * use addon * remove old * update deps * update stypes * update md * remove export * chore(storybook): Add theme picker to storybook toolbar Adds the theme picker to the storybook toolbar for internal development. The global types are exported since they will be used for the docs page. * remove unnecessary changes * update change * chore(storybook): Add custom DocsContainer to react-components storybook Initialize a custom `FluentDocsContainer` and FluentDocsHeader` to the react-components storybook for future toolbar items like theme and version picker. This custom header is required since our future plans to build with `--docs` will remove the native storybook toolbar * Change files * add docstring * remove font family style * init theme picker * revert manager * revert .storybook * remove dupe export * export * README * use active theme * add docstring * Change files * fix md * drop icon * update md * set global theme to react-components * add container to page * use type * header styling * styling updates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request checklist
$ yarn changeDescription of changes
Adds a theme picker to the docs page for
react-component. Since this picker leverages the same global state as #20346 , the state is persisted even when switching pages in storybook.This picker will still render for
react-componentswithout the--docsoption, but since it uses storybook globals, will be in sync with the picker in the storybook toolbarLatest iteration does not have the paint bucket icon below
Focus areas to test
(optional)