From 36d25e965ca50f24f8f1a1be8deede690ca70b93 Mon Sep 17 00:00:00 2001 From: Micah Godbolt Date: Thu, 23 Jun 2022 05:21:22 -0700 Subject: [PATCH] Convert @fluentui/react-text stories to index.stories.tsx approach (#23662) * chore: Convert Text to index based stories * changefile --- ...t-text-a50df107-186b-4e4b-ab2b-806d0e31b0b7.json | 7 +++++++ .../react-components/react-text/.storybook/main.js | 2 +- .../src/stories/{ => Text}/Default.stories.tsx | 4 ++-- .../src/stories/{ => Text}/TextBestPractices.md | 0 .../src/stories/{ => Text}/TextDescription.md | 0 .../src/stories/{ => Text}/TextFont.stories.tsx | 2 +- .../src/stories/{ => Text}/TextItalic.stories.tsx | 2 +- .../src/stories/{ => Text}/TextSize.stories.tsx | 2 +- .../{ => Text}/TextStrikeThrough.stories.tsx | 2 +- .../src/stories/{ => Text}/TextTruncate.stories.tsx | 2 +- .../stories/{ => Text}/TextTypography.stories.tsx | 13 ++++++++++++- .../stories/{ => Text}/TextUnderline.stories.tsx | 2 +- .../src/stories/{ => Text}/TextWeight.stories.tsx | 2 +- .../{Text.stories.tsx => Text/index.stories.tsx} | 2 +- 14 files changed, 30 insertions(+), 12 deletions(-) create mode 100644 change/@fluentui-react-text-a50df107-186b-4e4b-ab2b-806d0e31b0b7.json rename packages/react-components/react-text/src/stories/{ => Text}/Default.stories.tsx (79%) rename packages/react-components/react-text/src/stories/{ => Text}/TextBestPractices.md (100%) rename packages/react-components/react-text/src/stories/{ => Text}/TextDescription.md (100%) rename packages/react-components/react-text/src/stories/{ => Text}/TextFont.stories.tsx (86%) rename packages/react-components/react-text/src/stories/{ => Text}/TextItalic.stories.tsx (67%) rename packages/react-components/react-text/src/stories/{ => Text}/TextSize.stories.tsx (91%) rename packages/react-components/react-text/src/stories/{ => Text}/TextStrikeThrough.stories.tsx (71%) rename packages/react-components/react-text/src/stories/{ => Text}/TextTruncate.stories.tsx (82%) rename packages/react-components/react-text/src/stories/{ => Text}/TextTypography.stories.tsx (87%) rename packages/react-components/react-text/src/stories/{ => Text}/TextUnderline.stories.tsx (69%) rename packages/react-components/react-text/src/stories/{ => Text}/TextWeight.stories.tsx (85%) rename packages/react-components/react-text/src/stories/{Text.stories.tsx => Text/index.stories.tsx} (94%) diff --git a/change/@fluentui-react-text-a50df107-186b-4e4b-ab2b-806d0e31b0b7.json b/change/@fluentui-react-text-a50df107-186b-4e4b-ab2b-806d0e31b0b7.json new file mode 100644 index 00000000000000..53257b9fe00114 --- /dev/null +++ b/change/@fluentui-react-text-a50df107-186b-4e4b-ab2b-806d0e31b0b7.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: Convert Text to index based stories", + "packageName": "@fluentui/react-text", + "email": "mgodbolt@microsoft.com", + "dependentChangeType": "none" +} diff --git a/packages/react-components/react-text/.storybook/main.js b/packages/react-components/react-text/.storybook/main.js index 7b7abd0e691d38..f57cfd09509e78 100644 --- a/packages/react-components/react-text/.storybook/main.js +++ b/packages/react-components/react-text/.storybook/main.js @@ -2,7 +2,7 @@ const rootMain = require('../../../../.storybook/main'); module.exports = /** @type {Omit} */ ({ ...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) }; diff --git a/packages/react-components/react-text/src/stories/Default.stories.tsx b/packages/react-components/react-text/src/stories/Text/Default.stories.tsx similarity index 79% rename from packages/react-components/react-text/src/stories/Default.stories.tsx rename to packages/react-components/react-text/src/stories/Text/Default.stories.tsx index c8135ddb0eece3..6de1b6de7f2e0c 100644 --- a/packages/react-components/react-text/src/stories/Default.stories.tsx +++ b/packages/react-components/react-text/src/stories/Text/Default.stories.tsx @@ -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: { diff --git a/packages/react-components/react-text/src/stories/TextBestPractices.md b/packages/react-components/react-text/src/stories/Text/TextBestPractices.md similarity index 100% rename from packages/react-components/react-text/src/stories/TextBestPractices.md rename to packages/react-components/react-text/src/stories/Text/TextBestPractices.md diff --git a/packages/react-components/react-text/src/stories/TextDescription.md b/packages/react-components/react-text/src/stories/Text/TextDescription.md similarity index 100% rename from packages/react-components/react-text/src/stories/TextDescription.md rename to packages/react-components/react-text/src/stories/Text/TextDescription.md diff --git a/packages/react-components/react-text/src/stories/TextFont.stories.tsx b/packages/react-components/react-text/src/stories/Text/TextFont.stories.tsx similarity index 86% rename from packages/react-components/react-text/src/stories/TextFont.stories.tsx rename to packages/react-components/react-text/src/stories/Text/TextFont.stories.tsx index 2f7bebb1feaaa9..1a1644d53a78a0 100644 --- a/packages/react-components/react-text/src/stories/TextFont.stories.tsx +++ b/packages/react-components/react-text/src/stories/Text/TextFont.stories.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { Text } from '../index'; +import { Text } from '@fluentui/react-text'; export const Font = () => (
diff --git a/packages/react-components/react-text/src/stories/TextItalic.stories.tsx b/packages/react-components/react-text/src/stories/Text/TextItalic.stories.tsx similarity index 67% rename from packages/react-components/react-text/src/stories/TextItalic.stories.tsx rename to packages/react-components/react-text/src/stories/Text/TextItalic.stories.tsx index a7a4bce517bc07..cd611c549a8b8a 100644 --- a/packages/react-components/react-text/src/stories/TextItalic.stories.tsx +++ b/packages/react-components/react-text/src/stories/Text/TextItalic.stories.tsx @@ -1,4 +1,4 @@ import * as React from 'react'; -import { Text } from '../index'; +import { Text } from '@fluentui/react-text'; export const Italic = () => Italic text; diff --git a/packages/react-components/react-text/src/stories/TextSize.stories.tsx b/packages/react-components/react-text/src/stories/Text/TextSize.stories.tsx similarity index 91% rename from packages/react-components/react-text/src/stories/TextSize.stories.tsx rename to packages/react-components/react-text/src/stories/Text/TextSize.stories.tsx index a87e730bf56a4c..ac1a8181b5cfb5 100644 --- a/packages/react-components/react-text/src/stories/TextSize.stories.tsx +++ b/packages/react-components/react-text/src/stories/Text/TextSize.stories.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { Text } from '../index'; +import { Text } from '@fluentui/react-text'; export const Size = () => (
diff --git a/packages/react-components/react-text/src/stories/TextStrikeThrough.stories.tsx b/packages/react-components/react-text/src/stories/Text/TextStrikeThrough.stories.tsx similarity index 71% rename from packages/react-components/react-text/src/stories/TextStrikeThrough.stories.tsx rename to packages/react-components/react-text/src/stories/Text/TextStrikeThrough.stories.tsx index 70e863b68fe0ae..fb658424286f4d 100644 --- a/packages/react-components/react-text/src/stories/TextStrikeThrough.stories.tsx +++ b/packages/react-components/react-text/src/stories/Text/TextStrikeThrough.stories.tsx @@ -1,4 +1,4 @@ import * as React from 'react'; -import { Text } from '../index'; +import { Text } from '@fluentui/react-text'; export const StrikeThrough = () => Strikethrough text; diff --git a/packages/react-components/react-text/src/stories/TextTruncate.stories.tsx b/packages/react-components/react-text/src/stories/Text/TextTruncate.stories.tsx similarity index 82% rename from packages/react-components/react-text/src/stories/TextTruncate.stories.tsx rename to packages/react-components/react-text/src/stories/Text/TextTruncate.stories.tsx index d66efe31f3f759..3eba02f6383524 100644 --- a/packages/react-components/react-text/src/stories/TextTruncate.stories.tsx +++ b/packages/react-components/react-text/src/stories/Text/TextTruncate.stories.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { Text } from '../index'; +import { Text } from '@fluentui/react-text'; export const Truncate = () => ( diff --git a/packages/react-components/react-text/src/stories/TextTypography.stories.tsx b/packages/react-components/react-text/src/stories/Text/TextTypography.stories.tsx similarity index 87% rename from packages/react-components/react-text/src/stories/TextTypography.stories.tsx rename to packages/react-components/react-text/src/stories/Text/TextTypography.stories.tsx index af89b6da0debd5..7463224cd3180b 100644 --- a/packages/react-components/react-text/src/stories/TextTypography.stories.tsx +++ b/packages/react-components/react-text/src/stories/Text/TextTypography.stories.tsx @@ -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, +} from '@fluentui/react-text'; export const Typography = () => ( <> diff --git a/packages/react-components/react-text/src/stories/TextUnderline.stories.tsx b/packages/react-components/react-text/src/stories/Text/TextUnderline.stories.tsx similarity index 69% rename from packages/react-components/react-text/src/stories/TextUnderline.stories.tsx rename to packages/react-components/react-text/src/stories/Text/TextUnderline.stories.tsx index 78510ff05b0324..fe74e400d8ff4f 100644 --- a/packages/react-components/react-text/src/stories/TextUnderline.stories.tsx +++ b/packages/react-components/react-text/src/stories/Text/TextUnderline.stories.tsx @@ -1,4 +1,4 @@ import * as React from 'react'; -import { Text } from '../index'; +import { Text } from '@fluentui/react-text'; export const Underline = () => Underlined text; diff --git a/packages/react-components/react-text/src/stories/TextWeight.stories.tsx b/packages/react-components/react-text/src/stories/Text/TextWeight.stories.tsx similarity index 85% rename from packages/react-components/react-text/src/stories/TextWeight.stories.tsx rename to packages/react-components/react-text/src/stories/Text/TextWeight.stories.tsx index 752fa1af315d7f..7408fa3712ec9f 100644 --- a/packages/react-components/react-text/src/stories/TextWeight.stories.tsx +++ b/packages/react-components/react-text/src/stories/Text/TextWeight.stories.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { Text } from '../index'; +import { Text } from '@fluentui/react-text'; export const Weight = () => (
diff --git a/packages/react-components/react-text/src/stories/Text.stories.tsx b/packages/react-components/react-text/src/stories/Text/index.stories.tsx similarity index 94% rename from packages/react-components/react-text/src/stories/Text.stories.tsx rename to packages/react-components/react-text/src/stories/Text/index.stories.tsx index 3b364533fe2af6..aaaa7822f3f3ae 100644 --- a/packages/react-components/react-text/src/stories/Text.stories.tsx +++ b/packages/react-components/react-text/src/stories/Text/index.stories.tsx @@ -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';