From aa2201b8f20a97c63429a30e0910b2a627a9845f Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Sat, 14 May 2022 13:52:30 +0800 Subject: [PATCH] refactor(theme-classic): always collocate stylesheets with components in one folder --- .../src/theme/DocPage/Layout/Sidebar/index.tsx | 2 +- .../Layout/Sidebar/{index.module.css => styles.module.css} | 0 .../src/theme/DocPage/Layout/index.tsx | 5 ++--- .../DocPage/Layout/{index.module.css => styles.module.css} | 0 .../DocSidebarItem/{Category.tsx => Category/index.tsx} | 0 .../src/theme/DocSidebarItem/{Html.tsx => Html/index.tsx} | 2 +- .../{Html.module.css => Html/styles.module.css} | 0 .../src/theme/DocSidebarItem/{Link.tsx => Link/index.tsx} | 2 +- .../{Link.module.css => Link/styles.module.css} | 0 .../src/theme/MDXComponents/{Img.tsx => Img/index.tsx} | 3 ++- .../MDXComponents/{Img.module.css => Img/styles.module.css} | 0 .../{CollapseButton.tsx => CollapseButton/index.tsx} | 3 ++- .../styles.module.css} | 0 .../src/theme/TOCCollapsible/index.tsx | 3 ++- .../TOCCollapsible/{index.module.css => styles.module.css} | 0 15 files changed, 11 insertions(+), 9 deletions(-) rename packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Sidebar/{index.module.css => styles.module.css} (100%) rename packages/docusaurus-theme-classic/src/theme/DocPage/Layout/{index.module.css => styles.module.css} (100%) rename packages/docusaurus-theme-classic/src/theme/DocSidebarItem/{Category.tsx => Category/index.tsx} (100%) rename packages/docusaurus-theme-classic/src/theme/DocSidebarItem/{Html.tsx => Html/index.tsx} (95%) rename packages/docusaurus-theme-classic/src/theme/DocSidebarItem/{Html.module.css => Html/styles.module.css} (100%) rename packages/docusaurus-theme-classic/src/theme/DocSidebarItem/{Link.tsx => Link/index.tsx} (97%) rename packages/docusaurus-theme-classic/src/theme/DocSidebarItem/{Link.module.css => Link/styles.module.css} (100%) rename packages/docusaurus-theme-classic/src/theme/MDXComponents/{Img.tsx => Img/index.tsx} (93%) rename packages/docusaurus-theme-classic/src/theme/MDXComponents/{Img.module.css => Img/styles.module.css} (100%) rename packages/docusaurus-theme-classic/src/theme/TOCCollapsible/{CollapseButton.tsx => CollapseButton/index.tsx} (94%) rename packages/docusaurus-theme-classic/src/theme/TOCCollapsible/{CollapseButton.module.css => CollapseButton/styles.module.css} (100%) rename packages/docusaurus-theme-classic/src/theme/TOCCollapsible/{index.module.css => styles.module.css} (100%) diff --git a/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Sidebar/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Sidebar/index.tsx index 438d9f814e79..6585c6ec6888 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Sidebar/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Sidebar/index.tsx @@ -12,7 +12,7 @@ import type {Props} from '@theme/DocPage/Layout/Sidebar'; import ExpandButton from '@theme/DocPage/Layout/Sidebar/ExpandButton'; import clsx from 'clsx'; -import styles from './index.module.css'; +import styles from './styles.module.css'; import {ThemeClassNames, useDocsSidebar} from '@docusaurus/theme-common'; diff --git a/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Sidebar/index.module.css b/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Sidebar/styles.module.css similarity index 100% rename from packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Sidebar/index.module.css rename to packages/docusaurus-theme-classic/src/theme/DocPage/Layout/Sidebar/styles.module.css diff --git a/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/index.tsx b/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/index.tsx index 8f95807481fd..d0269db346b2 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/index.tsx @@ -11,11 +11,10 @@ import BackToTopButton from '@theme/BackToTopButton'; import type {Props} from '@theme/DocPage/Layout'; import DocPageLayoutSidebar from '@theme/DocPage/Layout/Sidebar'; import DocPageLayoutMain from '@theme/DocPage/Layout/Main'; - -import styles from './index.module.css'; - import {useDocsSidebar} from '@docusaurus/theme-common'; +import styles from './styles.module.css'; + export default function DocPageLayout({children}: Props): JSX.Element { const sidebar = useDocsSidebar(); const [hiddenSidebarContainer, setHiddenSidebarContainer] = useState(false); diff --git a/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/index.module.css b/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/styles.module.css similarity index 100% rename from packages/docusaurus-theme-classic/src/theme/DocPage/Layout/index.module.css rename to packages/docusaurus-theme-classic/src/theme/DocPage/Layout/styles.module.css diff --git a/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Category.tsx b/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Category/index.tsx similarity index 100% rename from packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Category.tsx rename to packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Category/index.tsx diff --git a/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Html.tsx b/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Html/index.tsx similarity index 95% rename from packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Html.tsx rename to packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Html/index.tsx index 0e97ec27788a..7f6bab8f6cc6 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Html.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Html/index.tsx @@ -10,7 +10,7 @@ import clsx from 'clsx'; import {ThemeClassNames} from '@docusaurus/theme-common'; import type {Props} from '@theme/DocSidebarItem/Html'; -import styles from './Html.module.css'; +import styles from './styles.module.css'; export default function DocSidebarItemHtml({ item, diff --git a/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Html.module.css b/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Html/styles.module.css similarity index 100% rename from packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Html.module.css rename to packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Html/styles.module.css diff --git a/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Link.tsx b/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Link/index.tsx similarity index 97% rename from packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Link.tsx rename to packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Link/index.tsx index 28c481eed42f..a6ed60aaf2c6 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Link.tsx +++ b/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Link/index.tsx @@ -14,7 +14,7 @@ import IconExternalLink from '@theme/IconExternalLink'; import type {Props} from '@theme/DocSidebarItem/Link'; -import styles from './Link.module.css'; +import styles from './styles.module.css'; export default function DocSidebarItemLink({ item, diff --git a/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Link.module.css b/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Link/styles.module.css similarity index 100% rename from packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Link.module.css rename to packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Link/styles.module.css diff --git a/packages/docusaurus-theme-classic/src/theme/MDXComponents/Img.tsx b/packages/docusaurus-theme-classic/src/theme/MDXComponents/Img/index.tsx similarity index 93% rename from packages/docusaurus-theme-classic/src/theme/MDXComponents/Img.tsx rename to packages/docusaurus-theme-classic/src/theme/MDXComponents/Img/index.tsx index a97bedc3e028..7e0c1c542eb5 100644 --- a/packages/docusaurus-theme-classic/src/theme/MDXComponents/Img.tsx +++ b/packages/docusaurus-theme-classic/src/theme/MDXComponents/Img/index.tsx @@ -7,9 +7,10 @@ import React from 'react'; import type {Props} from '@theme/MDXComponents/Img'; -import styles from './Img.module.css'; import clsx from 'clsx'; +import styles from './styles.module.css'; + function transformImgClassName(className?: string): string { return clsx(className, styles.img); } diff --git a/packages/docusaurus-theme-classic/src/theme/MDXComponents/Img.module.css b/packages/docusaurus-theme-classic/src/theme/MDXComponents/Img/styles.module.css similarity index 100% rename from packages/docusaurus-theme-classic/src/theme/MDXComponents/Img.module.css rename to packages/docusaurus-theme-classic/src/theme/MDXComponents/Img/styles.module.css diff --git a/packages/docusaurus-theme-classic/src/theme/TOCCollapsible/CollapseButton.tsx b/packages/docusaurus-theme-classic/src/theme/TOCCollapsible/CollapseButton/index.tsx similarity index 94% rename from packages/docusaurus-theme-classic/src/theme/TOCCollapsible/CollapseButton.tsx rename to packages/docusaurus-theme-classic/src/theme/TOCCollapsible/CollapseButton/index.tsx index 48eeb3afdb19..54d9bf415518 100644 --- a/packages/docusaurus-theme-classic/src/theme/TOCCollapsible/CollapseButton.tsx +++ b/packages/docusaurus-theme-classic/src/theme/TOCCollapsible/CollapseButton/index.tsx @@ -8,9 +8,10 @@ import React from 'react'; import clsx from 'clsx'; import Translate from '@docusaurus/Translate'; -import styles from './CollapseButton.module.css'; import type {Props} from '@theme/TOCCollapsible/CollapseButton'; +import styles from './styles.module.css'; + export default function TOCCollapsibleCollapseButton({ collapsed, ...props diff --git a/packages/docusaurus-theme-classic/src/theme/TOCCollapsible/CollapseButton.module.css b/packages/docusaurus-theme-classic/src/theme/TOCCollapsible/CollapseButton/styles.module.css similarity index 100% rename from packages/docusaurus-theme-classic/src/theme/TOCCollapsible/CollapseButton.module.css rename to packages/docusaurus-theme-classic/src/theme/TOCCollapsible/CollapseButton/styles.module.css diff --git a/packages/docusaurus-theme-classic/src/theme/TOCCollapsible/index.tsx b/packages/docusaurus-theme-classic/src/theme/TOCCollapsible/index.tsx index de818634329c..3a99a4fe7532 100644 --- a/packages/docusaurus-theme-classic/src/theme/TOCCollapsible/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/TOCCollapsible/index.tsx @@ -8,11 +8,12 @@ import React from 'react'; import clsx from 'clsx'; import {useCollapsible, Collapsible} from '@docusaurus/theme-common'; -import styles from './index.module.css'; import TOCItems from '@theme/TOCItems'; import type {Props} from '@theme/TOCCollapsible'; import CollapseButton from '@theme/TOCCollapsible/CollapseButton'; +import styles from './styles.module.css'; + export default function TOCCollapsible({ toc, className, diff --git a/packages/docusaurus-theme-classic/src/theme/TOCCollapsible/index.module.css b/packages/docusaurus-theme-classic/src/theme/TOCCollapsible/styles.module.css similarity index 100% rename from packages/docusaurus-theme-classic/src/theme/TOCCollapsible/index.module.css rename to packages/docusaurus-theme-classic/src/theme/TOCCollapsible/styles.module.css