Skip to content

docs(react-switch): cleanup stories & docs#23217

Merged
layershifter merged 3 commits into
microsoft:masterfrom
layershifter:docs/switch-cleanup
May 26, 2022
Merged

docs(react-switch): cleanup stories & docs#23217
layershifter merged 3 commits into
microsoft:masterfrom
layershifter:docs/switch-cleanup

Conversation

@layershifter

Copy link
Copy Markdown
Member

See comments on files 👇

Comment on lines +40 to +43
export type SwitchProps = Omit<
ComponentProps<Partial<SwitchSlots>, 'input'>,
'checked' | 'defaultChecked' | 'onChange'
> & {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

As we have own definition we need to exclude existing ones for checked & defaultChecked. It also solves problem with the description for props.

Before

image

After

image

- Only replace the On/Off labels if there are more specific labels for the setting. For example, you might use Show/Hide if the setting is "Show images".
- Keep descriptive text short and concise—two to four words; preferably nouns. For example, "Focused inbox" or "WiFi".

</details>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added best practices & component description, took it from existing docs (https://developer.microsoft.com/en-us/fluentui#/controls/web/toggle). We will probably need to follow up on it to cleanup, but it's better than we have currently:

image

export { Label } from './SwitchLabel.stories';
export { LabelWrapping } from './SwitchLabelWrapping.stories';
export { Required } from './SwitchRequired.stories';
export { Themed } from './SwitchThemed.stories';

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This story is redundant and does not match patterns that we have for other components. I removed it to avoid confusion. To check how a component looks in different themes customers can use the theme selector and exists on every page:

image

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The same was done for react-card in #23082.

@fabricteam

fabricteam commented May 25, 2022

Copy link
Copy Markdown
Collaborator

📊 Bundle size report

Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
181.156 kB
50.603 kB
react-components
react-components: FluentProvider & webLightTheme
34.078 kB
11.098 kB
react-switch
Switch
25.439 kB
8.247 kB
🤖 This report was generated against 303947a3e3687058c902a9a8bee1ecd1f19a92c8

@codesandbox-ci

codesandbox-ci Bot commented May 25, 2022

Copy link
Copy Markdown

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 c4a8e67:

Sandbox Source
@fluentui/react 8 starter Configuration
@fluentui/react-components 9 starter Configuration

@layershifter
layershifter marked this pull request as ready for review May 25, 2022 09:42
@layershifter
layershifter requested review from a team, behowell and khmakoto as code owners May 25, 2022 09:42
@fabricteam

fabricteam commented May 25, 2022

Copy link
Copy Markdown
Collaborator

Perf Analysis (@fluentui/react-components)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 932 931 5000
Button mount 573 569 5000
FluentProvider mount 1944 1963 5000
FluentProviderWithTheme mount 269 256 10
FluentProviderWithTheme virtual-rerender 249 213 10
FluentProviderWithTheme virtual-rerender-with-unmount 280 284 10
MakeStyles mount 1719 1691 50000

@size-auditor

size-auditor Bot commented May 25, 2022

Copy link
Copy Markdown

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: 303947a3e3687058c902a9a8bee1ecd1f19a92c8 (build)

@layershifter
layershifter merged commit 8735876 into microsoft:master May 26, 2022
@layershifter
layershifter deleted the docs/switch-cleanup branch May 26, 2022 13:55
marwan38 pushed a commit to marwan38/fluentui that referenced this pull request Jun 13, 2022
* docs(react-switch): cleanup stories & docs

* add changelog

* update API file
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.

4 participants