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

Updating docs on how to extend the tokens #33229

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mltejera
Copy link
Contributor

@mltejera mltejera commented Nov 7, 2024

Leave's Shift's existing migration docs in place so as to not break any current links.

Copies the whole document to the current docs folder.

Takes a subset of that out and moves it to

  • The patterns folder
  • The Storybook theming section (these new docs are The Way)

@mltejera mltejera requested review from a team as code owners November 7, 2024 19:40
Copy link

github-actions bot commented Nov 7, 2024

📊 Bundle size report

✅ No changes found

Copy link

github-actions bot commented Nov 7, 2024

Pull request demo site: URL

@@ -0,0 +1,407 @@
# Migration notes from `@fluentui/[email protected]`to `@fluentui/[email protected]`
Copy link
Member

Choose a reason for hiding this comment

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

Not sure that we want to this document in a new location. It was good in its time, some info in it is already outdated.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah agreed. The shorthands info is definitely out of date.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed this doc from the PR.


⚠ Components which use custom tokens cannot be shared between applications. Keep in mind that any application which uses a component with custom tokens must also add the custom tokens to its own themes. Instead of adding custom tokens inside potentially reusable components, you should talk to design.
⚠ Components in this repo should _not_ do this.
Copy link
Member

Choose a reason for hiding this comment

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

It's in public docsite, so we probably don't need this

Comment on lines +170 to 176
```
⚠ Keep in mind that the object generated by the `themeToTokensObject()` will contain all the tokens and will not be tree-shakeable.
```

```tsx
import { themeToTokensObject } from '@fluentui/react-components';
```
export const customTokens = themeToTokensObject(customLightTheme);
```
Copy link
Member

Choose a reason for hiding this comment

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

Delete this empty blocks?

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 catch - removed

Copy link
Contributor

@mainframev mainframev left a comment

Choose a reason for hiding this comment

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

A few typos only and suggestion is up to you 🙂

@@ -0,0 +1,407 @@
# Migration notes from `@fluentui/[email protected]`to `@fluentui/[email protected]`

Copy link
Contributor

Choose a reason for hiding this comment

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

Wdyt about adding ToC?

Suggested change
---
1. [Migration notes from `@fluentui/[email protected]` to `@fluentui/[email protected]`](#migration-notes-from-fluentuireact-components900-beta5-to-fluentuireact-components900-rc1)
2. [Changes to the styling system](#changes-to-the-styling-system)
- [Functions no longer supported](#functions-no-longer-supported)
- [CSS shorthands no longer supported](#css-shorthands-no-longer-supported)
- [makeStyles is now Griffel](#makestyles-is-now-griffel-just-rename)
3. [Changes to the theming system](#changes-to-the-theming-system)
- [Brand ramp updated](#brand-ramp-updated)
- [Tokens to css variables mapping is now exported](#tokens-to-css-variables-mapping-is-now-exported)
- [Custom tokens can now be passed as part of the Theme](#custom-tokens-can-now-be-passed-as-part-of-the-theme)
- [`themeToCSSVariables()` was removed](#themetocssvariables-was-removed)
4. [Typings & exports](#typings--exports)
- [Hooks are now exported with "_unstable" suffix](#hooks-are-now-exported-with-unstable-suffix)
- [`*Commons` types are no longer exported](#commons-types-are-no-longer-exported)
- [Removed functionality & exports](#removed-functionality--exports)
- [`useTheme()` hook is no longer exported](#usetheme-hook-is-no-longer-exported)
- [`mergeThemes()` function has been removed](#mergethemes-function-has-been-removed)
- [`*shorthandProps` removed](#shorthandprops-removed)
5. [Slot utilities have been updated and renamed](#slot-utilities-have-been-updated-and-renamed)
- [The `getSlots` function has been updated](#the-getslots-function-has-been-updated)
- [New `Slot` type, and renamed slot utility types](#new-slot-type-and-renamed-slot-utility-types)
6. [Component changes](#component-changes)
- [Accordion](#accordion)
- [Avatar](#avatar)
- [Button](#button)
- [Checkbox](#checkbox)
- [CompoundButton](#compoundbutton)
- [Icons](#icons)
- [FluentProvider](#fluentprovider)
- [Menu](#menu)
- [MenuButton](#menubutton)
- [ToggleButton](#togglebutton)
- [Tooltip](#tooltip)
---

[CSS shorthands](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties) in `makeStyles()` calls are no longer supported. For many shorthands there exist matching functions in `@fluentui/react-components`:

```ts
import { shorthands } from '@fluentui/react-componenents';
Copy link
Contributor

Choose a reason for hiding this comment

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

typo 🙂

Suggested change
import { shorthands } from '@fluentui/react-componenents';
import { shorthands } from '@fluentui/react-components';


```diff
import { makeStyles } from '@fluentui/react-componenents';
+import { makeStyles, shorthands } from '@fluentui/react-componenents';
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
+import { makeStyles, shorthands } from '@fluentui/react-componenents';
+import { makeStyles, shorthands } from '@fluentui/react-components';

Please apply following changes:

```diff
import { makeStyles } from '@fluentui/react-componenents';
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
import { makeStyles } from '@fluentui/react-componenents';
import { makeStyles } from '@fluentui/react-components';


### CSS shorthands no longer supported

[CSS shorthands](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties) in `makeStyles()` calls are no longer supported. For many shorthands there exist matching functions in `@fluentui/react-components`:
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't really accurate anymore right? https://griffel.js.org/react/guides/limitations#some-of-css-shorthands-are-not-supported

I think we should update this.

@@ -0,0 +1,407 @@
# Migration notes from `@fluentui/[email protected]`to `@fluentui/[email protected]`
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah agreed. The shorthands info is definitely out of date.

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