Skip to content
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": "update styles to not use CSS shorthands",
"packageName": "@fluentui/react-text",
"email": "olfedias@microsoft.com",
"dependentChangeType": "patch"
}
12 changes: 7 additions & 5 deletions packages/react-text/src/components/Text/Text.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ describe('Text', () => {
display: inline;
text-align: start;
white-space: normal;
overflow: visible;
overflow-x: visible;
overflow-y: visible;
text-overflow: clip;
`);
});
Expand All @@ -43,7 +44,8 @@ describe('Text', () => {
const textElement = getByText('Test');
expect(textElement).toHaveStyle(`
white-space: nowrap;
overflow: hidden;
overflow-x: hidden;
overflow-y: hidden;
`);
});

Expand Down Expand Up @@ -79,7 +81,7 @@ describe('Text', () => {

const textElement = getByText('Test');
expect(textElement).toHaveStyle(`
text-decoration: underline;
text-decoration-line: underline;
`);
});

Expand All @@ -88,7 +90,7 @@ describe('Text', () => {

const textElement = getByText('Test');
expect(textElement).toHaveStyle(`
text-decoration: line-through;
text-decoration-line: line-through;
`);
});

Expand All @@ -101,7 +103,7 @@ describe('Text', () => {

const textElement = getByText('Test');
expect(textElement).toHaveStyle(`
text-decoration: line-through underline;
text-decoration-line: line-through underline;
`);
});

Expand Down
12 changes: 6 additions & 6 deletions packages/react-text/src/components/Text/useTextStyles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeStyles, mergeClasses } from '@fluentui/react-make-styles';
import { makeStyles, mergeClasses, shorthands } from '@fluentui/react-make-styles';
import type { TextState } from './Text.types';

export const textClassName = 'fui-Text';
Expand All @@ -15,12 +15,12 @@ const useStyles = makeStyles({
textAlign: 'start',
display: 'inline',
whiteSpace: 'normal',
overflow: 'visible',
...shorthands.overflow('visible'),
textOverflow: 'clip',
}),
nowrap: {
whiteSpace: 'nowrap',
overflow: 'hidden',
...shorthands.overflow('hidden'),
},
truncate: {
textOverflow: 'ellipsis',
Expand All @@ -32,13 +32,13 @@ const useStyles = makeStyles({
fontStyle: 'italic',
},
underline: {
textDecoration: 'underline',
textDecorationLine: 'underline',
},
strikethrough: {
textDecoration: 'line-through',
textDecorationLine: 'line-through',
},
strikethroughUnderline: {
textDecoration: 'line-through underline',
textDecorationLine: 'line-through underline',
},
base100: theme => ({
fontSize: theme.fontSizeBase100,
Expand Down
4 changes: 2 additions & 2 deletions packages/react-text/src/stories/Default.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { makeStyles } from '@fluentui/react-make-styles';
import { Text } from '../Text'; // codesandbox-dependency: @fluentui/react-text ^9.0.0-beta
import type { TextProps } from '../Text'; // codesandbox-dependency: @fluentui/react-text ^9.0.0-beta
import { Text } from '../Text';
import type { TextProps } from '../Text';

const useStyles = makeStyles({
container: {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-text/src/stories/TextFont.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Text } from '../index'; // codesandbox-dependency: @fluentui/react-text ^9.0.0-beta
import { Text } from '../index';

export const Font = () => (
<div style={{ display: 'flex', gap: 20 }}>
Expand Down
2 changes: 1 addition & 1 deletion packages/react-text/src/stories/TextItalic.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react';
import { Text } from '../index'; // codesandbox-dependency: @fluentui/react-text ^9.0.0-beta
import { Text } from '../index';

export const Italic = () => <Text italic>Italic text</Text>;
2 changes: 1 addition & 1 deletion packages/react-text/src/stories/TextSize.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Text } from '../index'; // codesandbox-dependency: @fluentui/react-text ^9.0.0-beta
import { Text } from '../index';

export const Size = () => (
<div style={{ display: 'flex', gap: 10, alignItems: 'baseline' }}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react';
import { Text } from '../index'; // codesandbox-dependency: @fluentui/react-text ^9.0.0-beta
import { Text } from '../index';

export const StrikeThrough = () => <Text strikethrough>Strikethrough text</Text>;
2 changes: 1 addition & 1 deletion packages/react-text/src/stories/TextTruncate.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Text } from '../index'; // codesandbox-dependency: @fluentui/react-text ^9.0.0-beta
import { Text } from '../index';

export const Truncate = () => (
<Text truncate style={{ width: 100, overflow: 'hidden', whiteSpace: 'nowrap' }} block>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Body, Caption, Display, Headline, LargeTitle, Title1, Title2, Title3, Subheadline } from '../index'; // codesandbox-dependency: @fluentui/react-text ^9.0.0-beta
import { Body, Caption, Display, Headline, LargeTitle, Title1, Title2, Title3, Subheadline } from '../index';

export const Typography = () => (
<>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react';
import { Text } from '../index'; // codesandbox-dependency: @fluentui/react-text ^9.0.0-beta
import { Text } from '../index';

export const Underline = () => <Text underline>Underlined text</Text>;
2 changes: 1 addition & 1 deletion packages/react-text/src/stories/TextWeight.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Text } from '../index'; // codesandbox-dependency: @fluentui/react-text ^9.0.0-beta
import { Text } from '../index';

export const Weight = () => (
<div style={{ display: 'flex', gap: 20 }}>
Expand Down