Add font and typography documentation (#2363)

* Add font and typography documentation

* Text -> TextV1

* variants in typography object

Co-authored-by: Adam Gleitman <adgleitm@microsoft.com>
This commit is contained in:
Adam Gleitman 2022-12-01 16:22:29 -08:00 коммит произвёл GitHub
Родитель 739487fd63
Коммит ea467a62fb
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 17 добавлений и 2 удалений

Просмотреть файл

@ -78,9 +78,11 @@ export const defaultAvatarTokens: TokenSettings<AvatarTokens, Theme> = (t: Theme
...
```
### Font [in progress]
### Font
TO DO
You can find global tokens related to fonts, including font families, sizes, and weights, in the `globalTokens.font` property.
While you _could_ use these tokens directly in `Text` elements, this is not recommended. Instead, we recommend that you use the `variant` prop or the predefined JSX types as described in the [Typography](#typography) section, as these will pull in all the needed tokens automatically.
### Size
@ -132,3 +134,16 @@ const strokeSize = {
large: globalTokens.stroke.width40,
};
```
### Typography
In FURN, typography alias tokens can be passed into a `TextV1` element or wrapped using a JSX type. For example:
```tsx
import { Body1, TextV1 } from '@fluentui-react-native/text';
const myText = <TextV1 variant="body1">Here is some body text</TextV1>;
const moreText = <Body1>Here is some more body text</Body1>;
```
Given a `Theme` object named `theme`, you can get the available variants and their tokens by calling `theme.typography.variants`. The different text variants available on each platform can be found in the `Variants.platform.ts` files in `packages/components/text/src`. Note that not all variants are available on every platform, although most of them are.