Skip to content

Commit

Permalink
Rename Drafted to Draft and move under theme/ContentVisibility
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Aug 8, 2024
1 parent a852c69 commit 0d7d7e8
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 30 deletions.
6 changes: 3 additions & 3 deletions packages/docusaurus-theme-classic/src/theme-classic.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1602,20 +1602,20 @@ declare module '@theme/Tag' {
export default function Tag(props: Props): JSX.Element;
}

declare module '@theme/Unlisted' {
declare module '@theme/ContentVisibility/Unlisted' {
export interface Props {
className?: string;
}

export default function Unlisted(props: Props): JSX.Element;
}

declare module '@theme/Drafted' {
declare module '@theme/ContentVisibility/Draft' {
export interface Props {
className?: string;
}

export default function Unlisted(props: Props): JSX.Element;
export default function Draft(props: Props): JSX.Element;
}

declare module '@theme/prism-include-languages' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import BlogPostPageMetadata from '@theme/BlogPostPage/Metadata';
import BlogPostPageStructuredData from '@theme/BlogPostPage/StructuredData';
import TOC from '@theme/TOC';
import type {Props} from '@theme/BlogPostPage';
import Unlisted from '@theme/Unlisted';
import Drafted from '@theme/Drafted';
import Unlisted from '@theme/ContentVisibility/Unlisted';
import Draft from '@theme/ContentVisibility/Draft';
import type {BlogSidebar} from '@docusaurus/plugin-content-blog';

function BlogPostPageContent({
Expand Down Expand Up @@ -50,7 +50,7 @@ function BlogPostPageContent({
) : undefined
}>
{(unlisted || frontMatter.unlisted) && <Unlisted />}
{frontMatter.draft && <Drafted />}
{frontMatter.draft && <Draft />}

<BlogPostItem>{children}</BlogPostItem>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import BlogListPaginator from '@theme/BlogListPaginator';
import SearchMetadata from '@theme/SearchMetadata';
import type {Props} from '@theme/BlogTagsPostsPage';
import BlogPostItems from '@theme/BlogPostItems';
import Unlisted from '@theme/Unlisted';
import Unlisted from '@theme/ContentVisibility/Unlisted';
import Heading from '@theme/Heading';

function BlogTagsPostsPageMetadata({tag}: Props): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ import React from 'react';
import clsx from 'clsx';
import {
ThemeClassNames,
DraftedBannerTitle,
DraftedBannerMessage,
DraftBannerTitle,
DraftBannerMessage,
} from '@docusaurus/theme-common';
import Admonition from '@theme/Admonition';
import type {Props} from '@theme/Drafted';
import type {Props} from '@theme/ContentVisibility/Draft';

export default function Drafted({className}: Props): JSX.Element | null {
export default function Draft({className}: Props): JSX.Element | null {
return (
<Admonition
type="caution"
title={<DraftedBannerTitle />}
className={clsx(className, ThemeClassNames.common.draftedBanner)}>
<DraftedBannerMessage />
title={<DraftBannerTitle />}
className={clsx(className, ThemeClassNames.common.draftBanner)}>
<DraftBannerMessage />
</Admonition>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
UnlistedMetadata,
} from '@docusaurus/theme-common';
import Admonition from '@theme/Admonition';
import type {Props} from '@theme/Unlisted';
import type {Props} from '@theme/ContentVisibility/Unlisted';

function UnlistedBanner({className}: Props) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import DocItemTOCMobile from '@theme/DocItem/TOC/Mobile';
import DocItemTOCDesktop from '@theme/DocItem/TOC/Desktop';
import DocItemContent from '@theme/DocItem/Content';
import DocBreadcrumbs from '@theme/DocBreadcrumbs';
import Unlisted from '@theme/Unlisted';
import Unlisted from '@theme/ContentVisibility/Unlisted';
import Draft from '@theme/ContentVisibility/Draft';
import type {Props} from '@theme/DocItem/Layout';

import Drafted from '@theme/Drafted';
import styles from './styles.module.css';

/**
Expand Down Expand Up @@ -56,7 +56,7 @@ export default function DocItemLayout({children}: Props): JSX.Element {
<div className="row">
<div className={clsx('col', !docTOC.hidden && styles.docItemCol)}>
{(unlisted || frontMatter.unlisted) && <Unlisted />}
{frontMatter.draft && <Drafted />}
{frontMatter.draft && <Draft />}
<DocVersionBanner />
<div className={styles.docItemContainer}>
<article>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
import Translate, {translate} from '@docusaurus/Translate';
import SearchMetadata from '@theme/SearchMetadata';
import type {Props} from '@theme/DocTagDocListPage';
import Unlisted from '@theme/Unlisted';
import Unlisted from '@theme/ContentVisibility/Unlisted';
import Heading from '@theme/Heading';

// Very simple pluralization: probably good enough for now
Expand Down
6 changes: 3 additions & 3 deletions packages/docusaurus-theme-classic/src/theme/MDXPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import {
import Layout from '@theme/Layout';
import MDXContent from '@theme/MDXContent';
import TOC from '@theme/TOC';
import Unlisted from '@theme/Unlisted';
import Unlisted from '@theme/ContentVisibility/Unlisted';
import Draft from '@theme/ContentVisibility/Draft';
import type {Props} from '@theme/MDXPage';

import EditMetaRow from '@theme/EditMetaRow';
import Drafted from '@theme/Drafted';
import styles from './styles.module.css';

export default function MDXPage(props: Props): JSX.Element {
Expand Down Expand Up @@ -62,7 +62,7 @@ export default function MDXPage(props: Props): JSX.Element {
<div className={clsx('row', styles.mdxPageWrapper)}>
<div className={clsx('col', !hideTableOfContents && 'col--8')}>
{(unlisted || frontMatter.unlisted) && <Unlisted />}
{frontMatter.draft && <Drafted />}
{frontMatter.draft && <Draft />}
<article>
<MDXContent>
<MDXPageContent />
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-theme-common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export {
UnlistedMetadata,
} from './utils/unlistedUtils';

export {DraftedBannerTitle, DraftedBannerMessage} from './utils/draftedUtils';
export {DraftBannerTitle, DraftBannerMessage} from './utils/draftUtils';

export {
ErrorBoundaryTryAgainButton,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const ThemeClassNames = {
codeBlock: 'theme-code-block',
admonition: 'theme-admonition',
unlistedBanner: 'theme-unlisted-banner',
draftedBanner: 'theme-drafted-banner',
draftBanner: 'theme-drafted-banner',

admonitionType: (type: string) => `theme-admonition-${type}`,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
import React from 'react';
import Translate from '@docusaurus/Translate';

export function DraftedBannerTitle(): JSX.Element {
export function DraftBannerTitle(): JSX.Element {
return (
<Translate
id="theme.draftedContent.title"
id="theme.draftContent.title"
description="The drafted content banner title">
Drafted page
</Translate>
);
}

export function DraftedBannerMessage(): JSX.Element {
export function DraftBannerMessage(): JSX.Element {
return (
<Translate
id="theme.draftedContent.message"
id="theme.draftContent.message"
description="The drafted content banner message">
This page is drafted and will be excluded from production build.
</Translate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@
"theme.docs.versions.unmaintainedVersionLabel___DESCRIPTION": "The label used to tell the user that he's browsing an unmaintained doc version",
"theme.docs.versions.unreleasedVersionLabel": "This is unreleased documentation for {siteTitle} {versionLabel} version.",
"theme.docs.versions.unreleasedVersionLabel___DESCRIPTION": "The label used to tell the user that he's browsing an unreleased doc version",
"theme.draftedContent.message": "This page is drafted and will be excluded from production build.",
"theme.draftedContent.title": "Drafted page",
"theme.draftContent.title": "Draft page",
"theme.draftContent.message": "This page is a draft and will be excluded from production build.",
"theme.lastUpdated.atDate": " on {date}",
"theme.lastUpdated.atDate___DESCRIPTION": "The words used to describe on which date a page has been last updated",
"theme.lastUpdated.byUser": " by {user}",
Expand Down

0 comments on commit 0d7d7e8

Please sign in to comment.