Skip to content

docs: cleanup docs pages#23187

Merged
layershifter merged 1 commit into
microsoft:masterfrom
layershifter:docs-cleanup
May 25, 2022
Merged

docs: cleanup docs pages#23187
layershifter merged 1 commit into
microsoft:masterfrom
layershifter:docs-cleanup

Conversation

@layershifter

@layershifter layershifter commented May 24, 2022

Copy link
Copy Markdown
Member

See comments on files directly 👇

## Server-Side Rendering

Fluent UI fully supports Server-Side Rendering.
Fluent UI React v9 fully supports Server-Side Rendering.

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.

Mention this explicitly to avoid confusion.

Comment on lines +33 to +36
- primitive (`string`, `number`, `boolean`)
- HTML element (`div`, `span`, `img`)
- JSX component (`<MyCustomControl />`)
- render function (() => React.ReactNode)
- props object (InputProps, IconProps)
- render function (`() => React.ReactNode`)

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.

Formatting changes

- render function (() => React.ReactNode)
- props object (InputProps, IconProps)
- render function (`() => React.ReactNode`)
- props object (`InputProps`, `LabelProps`)

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.

I replaced IconProps as we don't rely have them in react-components


For example, the Avatar component has a badge slot.
Avatar limites this slot to components or render functions with PresenceBadgeProps props.
Avatar limits this slot to components or render functions with `PresenceBadgeProps` props.

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.

Typo

## Styling components

To style Fluent UI components `makeStyles` is used.
To style Fluent UI React v9 components `makeStyles` is used. `makeStyles` comes from [`Griffel`](https://griffel.js.org) a homegrown CSS-in-JS implementation which generates atomic CSS classes.

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.

Updated to match latest changes

When `mergeClasses()` is called, it merges all classes from first to last - the latter argument overwrites the previous ones (similar to `Object.assign()`).

```jsx
import { makeStyles, mergeClasses } from '@fluentui/react-components';

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 imports everywhere to make snippets copy-pastable

No matter what theme is used, the component styles are always the same. The only way to change the component styling is through theme tokens which can be used in style values.

```js
import { tokens } from '@fluentui/react-theme';

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.

We recommend to use @fluentui/react-components, let's be consistent


const useOverrides = makeStyles({
button: { color: tokens.colorNeutralForeground3 },
buttonIcon: { border: '1px solid red'},

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.

Oops, shorthands are not supported, updated it

return (
<>
<Button className={overrides.button} icon={{className: overrides.buttonIcon, children: <CallIcon />}} />
<Button className={overrides.button} icon={{ className: overrides.buttonIcon, children: <CallEndRegular /> }} />

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 real icon to be used

import { Meta } from '@storybook/addon-docs';

<Meta title="Concepts/Upgrading/from v0/Components/Textarea Upgrade" />
<Meta title="Concepts/Upgrading/from v8/Components/Textarea Upgrade" />

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 causes funny collision as this page gets displayed for v0

'The `positioningRef` positioning prop provides an [imperative handle](https://reactjs.org/docs/hooks-reference.html#useimperativehandle)',
'to manually position an element. The target can be a normal HTML element or a virtual element such as a',
'coordinate on the viewport',
'coordinate on the viewport.',

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.

Missing dot

story: [
'The positioned element can be offset from the target element by using a callback function.',
'The callback function provides the arguments and are a values used directly by Popper.',
'The callback function provides the following arguments:',

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.

Updated to reflect changes from #22586

'',
'- Simple array with X and Y axis values',
'- A function that returns the array offset value',
'- An object with `mainAxis` and `crossAxis` values',

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.

Updated to reflect changes from #22586

Comment on lines +6 to +7
const [crossAxis, setCrossAxis] = React.useState(10);
const [mainAxis, setMainAxis] = React.useState(10);

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.

Changes names in snippet to match actual code

@layershifter
layershifter marked this pull request as ready for review May 24, 2022 16:06
@layershifter
layershifter requested review from a team as code owners May 24, 2022 16:06
@codesandbox-ci

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 3de9808:

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

@fabricteam

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.604 kB
react-components
react-components: FluentProvider & webLightTheme
34.078 kB
11.098 kB
🤖 This report was generated against dd94d998cb154a07cfc70ac760707231c18e41e8

@size-auditor

size-auditor Bot commented May 24, 2022

Copy link
Copy Markdown

Asset size changes

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

Baseline commit: dd94d998cb154a07cfc70ac760707231c18e41e8 (build)

@fabricteam

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 1284 1212 5000
Button mount 772 810 5000
FluentProvider mount 2288 2243 5000
FluentProviderWithTheme mount 392 428 10
FluentProviderWithTheme virtual-rerender 370 380 10
FluentProviderWithTheme virtual-rerender-with-unmount 455 452 10
MakeStyles mount 1968 1983 50000

@layershifter
layershifter merged commit 13abae1 into microsoft:master May 25, 2022
marwan38 pushed a commit to marwan38/fluentui that referenced this pull request Jun 13, 2022
@layershifter
layershifter deleted the docs-cleanup branch December 20, 2022 12:05
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.

5 participants