From 9a667befada0a01ce99040652e7e4949fabef5e3 Mon Sep 17 00:00:00 2001 From: Martin Heidegger Date: Fri, 18 Oct 2024 22:00:19 +0900 Subject: [PATCH 1/6] fix: replacing defaultProps --- 2024/src/components/LinkButton.tsx | 11 +++-------- 2024/src/components/Logo.tsx | 10 +++------- 2024/src/components/Logo2023.tsx | 10 +++------- 2024/src/components/Seo.tsx | 14 ++++++-------- 2024/src/pages/index.tsx | 4 ++-- 5 files changed, 17 insertions(+), 32 deletions(-) diff --git a/2024/src/components/LinkButton.tsx b/2024/src/components/LinkButton.tsx index 60f73df98..1c09c7208 100644 --- a/2024/src/components/LinkButton.tsx +++ b/2024/src/components/LinkButton.tsx @@ -69,15 +69,15 @@ const ExternalSecondaryBox = styled(ExternalBox)` export type Props = { color?: "primary" | "secondary" - size: "inline" | "normal" | "large" + size?: "inline" | "normal" | "large" to: string - disabled: boolean onClick?: MouseEventHandler children: React.ReactNode } export function LinkButton(props: Props) { - const { color, to, size, onClick, children } = props + const { color, to, onClick, children } = props + const size = props.size ?? "normal" if (!to?.startsWith("http")) { if (color === "primary") { @@ -131,8 +131,3 @@ export function LinkButton(props: Props) { ) } } - -LinkButton.defaultProps = { - disabled: false, - size: "normal", -} diff --git a/2024/src/components/Logo.tsx b/2024/src/components/Logo.tsx index 5d5b75502..7fa5532c2 100644 --- a/2024/src/components/Logo.tsx +++ b/2024/src/components/Logo.tsx @@ -2,15 +2,11 @@ import React from "react" import logo from "../images/logo.svg" type Props = { - size: number + size?: number } -export function Logo(props: Props) { - const { size } = props +export const Logo = (props: Props) => { + const size = props.size ?? 125 return JSConf JP } - -Logo.defaultProps = { - size: 125, -} diff --git a/2024/src/components/Logo2023.tsx b/2024/src/components/Logo2023.tsx index 13f38444f..e7688fcea 100644 --- a/2024/src/components/Logo2023.tsx +++ b/2024/src/components/Logo2023.tsx @@ -2,15 +2,11 @@ import React from "react" import logo2023 from "../images/logo-2023.png" type Props = { - size: number + size?: number } -export function Logo2023(props: Props) { - const { size } = props +export const Logo2023 = (props: Props) => { + const size = props.size ?? 125 return JSConf JP 2023 } - -Logo2023.defaultProps = { - size: 125, -} diff --git a/2024/src/components/Seo.tsx b/2024/src/components/Seo.tsx index 5926bb13d..2126e989d 100644 --- a/2024/src/components/Seo.tsx +++ b/2024/src/components/Seo.tsx @@ -6,13 +6,17 @@ type MetaProps = JSX.IntrinsicElements["meta"] type Props = { description?: string | null - lang: Languages - meta: MetaProps[] + lang?: Languages + meta?: MetaProps[] title?: string | null ogImage?: string } export function SEO({ description, ogImage, lang, meta, title }: Props) { + lang ??= "en" + meta ??= [] + description ??= "" + const { site, logo } = useStaticQuery(graphql` query { site { @@ -88,9 +92,3 @@ export function SEO({ description, ogImage, lang, meta, title }: Props) { /> ) } - -SEO.defaultProps = { - lang: `en`, - meta: [], - description: ``, -} diff --git a/2024/src/pages/index.tsx b/2024/src/pages/index.tsx index e88e5f15b..df0ea9907 100644 --- a/2024/src/pages/index.tsx +++ b/2024/src/pages/index.tsx @@ -261,7 +261,7 @@ export default function IndexPage() { subTitle: t("callForSponsors"), available: site.siteMetadata.sponsorFormUrl, render: () => - site.siteMetadata.sponsorFormUrl ? ( + false ? ( ) : ( - + {t("comingSoon")} ), From 044b73dc984c09ec123b07c16277fcdba4762121 Mon Sep 17 00:00:00 2001 From: Martin Heidegger Date: Fri, 18 Oct 2024 22:00:19 +0900 Subject: [PATCH 2/6] fix: upgrading style-components to @6 --- 2024/src/components/Layout.tsx | 15 ++++++++++--- 2024/src/pages/schedule.tsx | 41 +++++++++++++++++++++------------- 2 files changed, 38 insertions(+), 18 deletions(-) diff --git a/2024/src/components/Layout.tsx b/2024/src/components/Layout.tsx index 20f8d6b96..3a726b95b 100644 --- a/2024/src/components/Layout.tsx +++ b/2024/src/components/Layout.tsx @@ -1,5 +1,9 @@ import React, { useCallback } from "react" -import styled, { ThemeProvider } from "styled-components" +import styled, { + StyleSheetManager, + ThemeProvider, + WebTarget, +} from "styled-components" import { useStaticQuery, graphql } from "gatsby" import { useTranslation } from "react-i18next" @@ -69,6 +73,11 @@ const BackToTopButton = styled.button` background-color: ${({ theme }) => theme.colors.primary}; ` +function shouldForwardProp(_propName: string, _target: WebTarget) { + // See: https://styled-components.com/docs/faqs#what-do-i-need-to-do-to-migrate-to-v6 + return true +} + export function Layout({ children, background }: Props) { const { t, i18n } = useTranslation() const onChangeLanguage = useCallback( @@ -97,7 +106,7 @@ export function Layout({ children, background }: Props) { return ( - <> +