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

Convert @fluentui/react-text stories to index.stories.tsx approach #23662

Merged
merged 3 commits into from
Jun 23, 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": "none",
"comment": "chore: Convert Text to index based stories",
"packageName": "@fluentui/react-text",
"email": "[email protected]",
"dependentChangeType": "none"
}
2 changes: 1 addition & 1 deletion packages/react-components/react-text/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const rootMain = require('../../../../.storybook/main');

module.exports = /** @type {Omit<import('../../../../.storybook/main'), 'typescript'|'babel'>} */ ({
...rootMain,
stories: [...rootMain.stories, '../src/**/*.stories.mdx', '../src/**/*.stories.@(ts|tsx)'],
stories: [...rootMain.stories, '../src/**/*.stories.mdx', '../src/**/index.stories.@(ts|tsx)'],
addons: [...rootMain.addons],
webpackFinal: (config, options) => {
const localConfig = { ...rootMain.webpackFinal(config, options) };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { makeStyles } from '@griffel/react';
import { Text } from '../Text';
import type { TextProps } from '../Text';
import { Text } from '@fluentui/react-text';
import type { TextProps } from '@fluentui/react-text';

const useStyles = makeStyles({
container: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Text } from '../index';
import { Text } from '@fluentui/react-text';

export const Font = () => (
<div style={{ display: 'flex', gap: 20 }}>
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';
import { Text } from '@fluentui/react-text';

export const Italic = () => <Text italic>Italic text</Text>;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Text } from '../index';
import { Text } from '@fluentui/react-text';

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';
import { Text } from '@fluentui/react-text';

export const StrikeThrough = () => <Text strikethrough>Strikethrough text</Text>;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Text } from '../index';
import { Text } from '@fluentui/react-text';

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,16 @@
import * as React from 'react';
import { Body1, Caption1, Display, Subtitle1, LargeTitle, Title1, Title2, Title3, Subtitle2, Caption2 } from '../index';
import {
Body1,
Caption1,
Display,
Subtitle1,
LargeTitle,
Title1,
Title2,
Title3,
Subtitle2,
Caption2,
Comment on lines +3 to +12
Copy link
Member

Choose a reason for hiding this comment

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

nit: You could go the extra mile and order these alphabetically

Suggested change
Body1,
Caption1,
Display,
Subtitle1,
LargeTitle,
Title1,
Title2,
Title3,
Subtitle2,
Caption2,
Body1,
Caption1,
Caption2,
Display,
LargeTitle,
Subtitle1,
Subtitle2,
Title1,
Title2,
Title3,

} from '@fluentui/react-text';

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';
import { Text } from '@fluentui/react-text';

export const Underline = () => <Text underline>Underlined text</Text>;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Text } from '../index';
import { Text } from '@fluentui/react-text';

export const Weight = () => (
<div style={{ display: 'flex', gap: 20 }}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Meta } from '@storybook/react';
import { Text } from '../Text';
import { Text } from '@fluentui/react-text';
import textDescriptionMd from './TextDescription.md';
import textBestPractices from './TextBestPractices.md';

Expand Down