From a28952130ab01e1f997caada8ac832c6115a0660 Mon Sep 17 00:00:00 2001 From: jakubabrzy Date: Wed, 20 Sep 2023 12:57:27 +0200 Subject: [PATCH] theme types --- src/theme/BlogLastPost/index.tsx | 9 ++++++++- src/theme/BlogLayout/index.tsx | 3 ++- src/theme/BlogListItem/index.tsx | 9 ++++++++- src/theme/BlogListItems/index.tsx | 10 +++++++++- src/theme/BlogListPage/index.tsx | 3 ++- src/theme/BlogListPaginator/index.tsx | 4 +++- src/theme/BlogPostItem/Content/index.tsx | 3 ++- src/theme/DocBreadcrumbs/index.tsx | 12 +++++++----- src/theme/DocItem/Content.tsx | 3 ++- src/theme/DocPage/Layout/Sidebar.tsx | 8 ++++++-- src/theme/DocPage/Layout/index.tsx | 2 +- src/theme/DocPaginator/index.tsx | 9 +++++++-- src/theme/PaginatorNavLink/index.tsx | 3 ++- 13 files changed, 59 insertions(+), 19 deletions(-) diff --git a/src/theme/BlogLastPost/index.tsx b/src/theme/BlogLastPost/index.tsx index 80527844..de588a03 100644 --- a/src/theme/BlogLastPost/index.tsx +++ b/src/theme/BlogLastPost/index.tsx @@ -2,8 +2,15 @@ import React from "react"; import PatternBg from "@site/src/components/PatternBg"; import Button from "@site/src/components/Button"; import Link from "@docusaurus/Link"; +import { PropBlogPostContent } from "@docusaurus/plugin-content-blog"; -export default function BlogLastPost({ item }) { +type BlogLastPostProps = { + item: { + content: PropBlogPostContent; + }; +}; + +export default function BlogLastPost({ item }: BlogLastPostProps) { const { permalink, title, date, formattedDate, description } = item.content.metadata; diff --git a/src/theme/BlogLayout/index.tsx b/src/theme/BlogLayout/index.tsx index 935e9ccf..ab311793 100644 --- a/src/theme/BlogLayout/index.tsx +++ b/src/theme/BlogLayout/index.tsx @@ -1,8 +1,9 @@ import React from "react"; import Layout from "@theme/Layout"; +import { Props } from "@theme/BlogLayout"; -export default function BlogLayout(props) { +export default function BlogLayout(props: Props) { const { children, ...layoutProps } = props; return ( diff --git a/src/theme/BlogListItem/index.tsx b/src/theme/BlogListItem/index.tsx index 1a7c2e58..6b8399a9 100644 --- a/src/theme/BlogListItem/index.tsx +++ b/src/theme/BlogListItem/index.tsx @@ -1,8 +1,15 @@ import Link from "@docusaurus/Link"; import Button from "@site/src/components/Button"; import React from "react"; +import { PropBlogPostContent } from "@docusaurus/plugin-content-blog"; -export default function BlogListItem({ item }) { +type BlogListItemProps = { + item: { + content: PropBlogPostContent; + }; +}; + +export default function BlogListItem({ item }: BlogListItemProps) { const { permalink, title, date, formattedDate, description } = item.content.metadata; diff --git a/src/theme/BlogListItems/index.tsx b/src/theme/BlogListItems/index.tsx index 404ca689..d7ab3245 100644 --- a/src/theme/BlogListItems/index.tsx +++ b/src/theme/BlogListItems/index.tsx @@ -1,7 +1,15 @@ import React from "react"; import BlogListItem from "@theme/BlogListItem"; -export default function BlogListItems({ items }) { +import { PropBlogPostContent } from "@docusaurus/plugin-content-blog"; + +type BlogListItemsProps = { + items: readonly { + content: PropBlogPostContent; + }[]; +}; + +export default function BlogListItems({ items }: BlogListItemsProps) { return (
{items.map((item) => ( diff --git a/src/theme/BlogListPage/index.tsx b/src/theme/BlogListPage/index.tsx index 7fef3d9b..d7a66014 100644 --- a/src/theme/BlogListPage/index.tsx +++ b/src/theme/BlogListPage/index.tsx @@ -6,8 +6,9 @@ import BlogListPaginator from "@theme/BlogListPaginator"; import SearchMetadata from "@theme/SearchMetadata"; import BlogListItems from "@theme/BlogListItems"; import BlogLastPost from "@theme/BlogLastPost"; +import { Props } from "@theme/BlogListPage"; -export default function BlogListPage(props) { +export default function BlogListPage(props: Props) { const { metadata, items } = props; const { blogDescription, blogTitle } = metadata; diff --git a/src/theme/BlogListPaginator/index.tsx b/src/theme/BlogListPaginator/index.tsx index a392fc0f..4963ecc7 100644 --- a/src/theme/BlogListPaginator/index.tsx +++ b/src/theme/BlogListPaginator/index.tsx @@ -1,7 +1,9 @@ import React from "react"; import Button from "@site/src/components/Button"; -export default function BlogListPaginator(props) { +import { Props } from "@theme/BlogListPaginator"; + +export default function BlogListPaginator(props: Props) { const { metadata } = props; const { previousPage, nextPage } = metadata; return ( diff --git a/src/theme/BlogPostItem/Content/index.tsx b/src/theme/BlogPostItem/Content/index.tsx index a8a879fa..d1ab95ec 100644 --- a/src/theme/BlogPostItem/Content/index.tsx +++ b/src/theme/BlogPostItem/Content/index.tsx @@ -3,8 +3,9 @@ import { blogPostContainerID } from "@docusaurus/utils-common"; import { useBlogPost } from "@docusaurus/theme-common/internal"; import MDXContent from "@theme/MDXContent"; import TextContent from "@site/src/components/TextContent"; +import { Props } from "@theme/BlogPostItem/Content"; -export default function BlogPostItemContent({ children }) { +export default function BlogPostItemContent({ children }: Props) { const { isBlogPostPage } = useBlogPost(); return ( diff --git a/src/theme/DocItem/Content.tsx b/src/theme/DocItem/Content.tsx index 79fc2e8f..0feb94b6 100644 --- a/src/theme/DocItem/Content.tsx +++ b/src/theme/DocItem/Content.tsx @@ -1,8 +1,9 @@ import React from "react"; import MDXContent from "@theme/MDXContent"; import TextContent from "@site/src/components/TextContent"; +import { Props } from "@theme/DocItem/Content"; -export default function DocItemContent({ children }) { +export default function DocItemContent({ children }: Props) { return ( {children} diff --git a/src/theme/DocPage/Layout/Sidebar.tsx b/src/theme/DocPage/Layout/Sidebar.tsx index 8162dd90..edd053eb 100644 --- a/src/theme/DocPage/Layout/Sidebar.tsx +++ b/src/theme/DocPage/Layout/Sidebar.tsx @@ -27,12 +27,16 @@ export default function DocPageLayoutSidebar({ sidebar, }: SidebarProps) { const { pathname } = useLocation(); - return ( diff --git a/src/theme/DocPage/Layout/index.tsx b/src/theme/DocPage/Layout/index.tsx index ab265ed5..ef120b1c 100644 --- a/src/theme/DocPage/Layout/index.tsx +++ b/src/theme/DocPage/Layout/index.tsx @@ -1,8 +1,8 @@ import React from "react"; +import DocPageLayoutSidebar from "./Sidebar"; import { useDocsSidebar } from "@docusaurus/theme-common/internal"; import Layout from "@theme/Layout"; import BackToTopButton from "@theme/BackToTopButton"; -import DocPageLayoutSidebar from "@theme/DocPage/Layout/Sidebar"; import type { Props } from "@theme/DocPage/Layout"; export default function DocPageLayout({ children }: Props) { diff --git a/src/theme/DocPaginator/index.tsx b/src/theme/DocPaginator/index.tsx index a265e31d..7a608be1 100644 --- a/src/theme/DocPaginator/index.tsx +++ b/src/theme/DocPaginator/index.tsx @@ -6,11 +6,16 @@ export default function DocPaginator(props: Props) { const { previous, next } = props; return (