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

react-spinner: Use shared tokens #22949

Merged
merged 2 commits into from
May 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Updated to use tokens were possible",
"packageName": "@fluentui/react-spinner",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { makeStyles, mergeClasses, shorthands } from '@griffel/react';
import { tokens } from '@fluentui/react-theme';
import { tokens, typographyStyles } from '@fluentui/react-theme';
import type { SpinnerState, SpinnerSlots } from './Spinner.types';
import type { SlotClassNames } from '@fluentui/react-utilities';

Expand Down Expand Up @@ -37,16 +37,6 @@ const spinnnerSizes = {
huge: '44px',
};

/*
* TODO: Update with proper tokens when added
* Stroke widths for the Spinner
*/
const spinnerStrokeWidth = {
sWidth: '2px',
mWidth: '3px',
lWidth: '4px',
};

/*
* TODO: Update with proper tokens when added
* Animation for Spinner
Expand All @@ -60,27 +50,6 @@ const spinnerAnimation = {
},
};

/*
* TODO: Update with proper tokens when added
* Label sizes for the Spinner
*/
const labelSizeTokens = {
body1: {
fontSize: tokens.fontSizeBase300,
lineHeight: tokens.lineHeightBase300,
},

subtitle2: {
fontSize: tokens.fontSizeBase400,
lineHeight: tokens.lineHeightBase400,
},

subtitle1: {
fontSize: tokens.fontSizeBase500,
lineHeight: tokens.lineHeightBase500,
},
};

/**
* Styles for the root slot
*/
Expand Down Expand Up @@ -127,7 +96,7 @@ const useLoaderStyles = makeStyles({
width: spinnnerSizes.tiny,
},
['& > svg > circle']: {
strokeWidth: spinnerStrokeWidth.sWidth,
strokeWidth: tokens.strokeWidthThick,
r: rValues.tiny,
},
},
Expand All @@ -138,7 +107,7 @@ const useLoaderStyles = makeStyles({
width: spinnnerSizes.extraSmall,
},
['& > svg > circle']: {
strokeWidth: spinnerStrokeWidth.sWidth,
strokeWidth: tokens.strokeWidthThick,
r: rValues.extraSmall,
},
},
Expand All @@ -149,7 +118,7 @@ const useLoaderStyles = makeStyles({
width: spinnnerSizes.small,
},
['& > svg > circle']: {
strokeWidth: spinnerStrokeWidth.sWidth,
strokeWidth: tokens.strokeWidthThick,
r: rValues.small,
},
},
Expand All @@ -160,7 +129,7 @@ const useLoaderStyles = makeStyles({
width: spinnnerSizes.medium,
},
['& > svg > circle']: {
strokeWidth: spinnerStrokeWidth.mWidth,
strokeWidth: tokens.strokeWidthThicker,
r: rValues.medium,
},
},
Expand All @@ -171,7 +140,7 @@ const useLoaderStyles = makeStyles({
width: spinnnerSizes.large,
},
['& > svg > circle']: {
strokeWidth: spinnerStrokeWidth.mWidth,
strokeWidth: tokens.strokeWidthThicker,
r: rValues.large,
},
},
Expand All @@ -182,7 +151,7 @@ const useLoaderStyles = makeStyles({
width: spinnnerSizes.extraLarge,
},
['& > svg > circle']: {
strokeWidth: spinnerStrokeWidth.mWidth,
strokeWidth: tokens.strokeWidthThicker,
r: rValues.extraLarge,
},
},
Expand All @@ -193,7 +162,7 @@ const useLoaderStyles = makeStyles({
width: spinnnerSizes.huge,
},
['& > svg > circle']: {
strokeWidth: spinnerStrokeWidth.lWidth,
strokeWidth: tokens.strokeWidthThickest,
r: rValues.huge,
},
},
Expand Down Expand Up @@ -273,31 +242,31 @@ const useLabelStyles = makeStyles({
// style for label

tiny: {
...labelSizeTokens.body1,
...typographyStyles.body1,
},

extraSmall: {
...labelSizeTokens.body1,
...typographyStyles.body1,
},

small: {
...labelSizeTokens.body1,
...typographyStyles.body1,
},

medium: {
...labelSizeTokens.subtitle2,
...typographyStyles.subtitle2,
},

large: {
...labelSizeTokens.subtitle2,
...typographyStyles.subtitle2,
},

extraLarge: {
...labelSizeTokens.subtitle2,
...typographyStyles.subtitle2,
},

huge: {
...labelSizeTokens.subtitle1,
...typographyStyles.subtitle1,
},
});

Expand Down