From 32b12c58fbd21cbb377740de2ed34e343e4beed8 Mon Sep 17 00:00:00 2001 From: joker Date: Fri, 28 Oct 2022 22:20:06 +0300 Subject: [PATCH] modified: components/Head.tsx modified: components/ThemeSwitch.tsx modified: pages/posts/[slug].tsx modified: types/post.ts --- components/Head.tsx | 11 +++++------ components/ThemeSwitch.tsx | 6 +----- pages/posts/[slug].tsx | 2 +- types/post.ts | 2 +- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/components/Head.tsx b/components/Head.tsx index 288da04..15f8389 100644 --- a/components/Head.tsx +++ b/components/Head.tsx @@ -7,14 +7,13 @@ export type WithYandexMetrikaProps = { children: React.ReactNode; } -export const WEBSITE_HOST_URL = 'https://robotop.krasnikov.pro'; +export const WEBSITE_HOST_URL = 'https://krasnikov.pro'; const Head = ({ customMeta }: { customMeta?: MetaProps }): JSX.Element => { const router = useRouter(); const meta: MetaProps = { - title: 'РоботТоп - робототехнический фестиваль', - description: - 'РоботТОП – это робототехнические соревнования, в которых могут принять участие молодые любители робототехники, объединившись в команды.', + title: 'Krasnikov.pro', + description: 'Krasnikov.pro – робототехника, программирование', image: `${WEBSITE_HOST_URL}/images/site-preview.png`, type: 'website', ...customMeta, @@ -23,11 +22,11 @@ const Head = ({ customMeta }: { customMeta?: MetaProps }): JSX.Element => { return ( {meta.title} - + - + diff --git a/components/ThemeSwitch.tsx b/components/ThemeSwitch.tsx index 5ed54d6..2d950d6 100644 --- a/components/ThemeSwitch.tsx +++ b/components/ThemeSwitch.tsx @@ -8,11 +8,7 @@ const ThemeSwitch = (): JSX.Element => { // After mounting, we have access to the theme React.useEffect(() => setMounted(true), []); - - if (!mounted) { - return null; - } - + const isDark = theme === 'dark'; const color = isDark ? '#fff' : '#000'; const maskColor = isDark ? '#000' : '#fff'; diff --git a/pages/posts/[slug].tsx b/pages/posts/[slug].tsx index ba8c9d7..b4b89d9 100644 --- a/pages/posts/[slug].tsx +++ b/pages/posts/[slug].tsx @@ -56,7 +56,7 @@ const PostPage = ({ source, frontMatter }: PostPageProps): JSX.Element => { ); }; -export const getStaticProps: GetStaticProps = async ({ params }) => { +export const getStaticProps: GetStaticProps = async ({ params }: any) => { const postFilePath = path.join(POSTS_PATH, `${params.slug}.mdx`); const source = fs.readFileSync(postFilePath); diff --git a/types/post.ts b/types/post.ts index db1eba6..0b678b9 100644 --- a/types/post.ts +++ b/types/post.ts @@ -1,5 +1,5 @@ export type PostType = { - date?: string; + date?: string |any; description?: string; image?: string; slug: string;