From ae959ca7a41793abd68f887f9eea10154e434a7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20Trembeck=C3=BD?= Date: Fri, 12 Apr 2024 20:15:22 +0200 Subject: [PATCH] Single text node as browser title to fix warning (#325) --- src/components/PageLayout/PageLayout.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/PageLayout/PageLayout.tsx b/src/components/PageLayout/PageLayout.tsx index 2ced9a35..6e5d23d4 100644 --- a/src/components/PageLayout/PageLayout.tsx +++ b/src/components/PageLayout/PageLayout.tsx @@ -29,13 +29,14 @@ const seminarTitle: Record = { // ked budeme potrebovat top-level stranky ako `/ina-stranka`, budeme musiet upravit, ako sa pracuje s `useSeminarInfo` export const PageLayout: FC = ({contentWidth = 2, title = '', children}) => { const {seminar} = useSeminarInfo() + const browserTitlePrefix = title && `${title} | ` + const browserTitle = `${browserTitlePrefix}${seminarTitle[seminar]}` + return ( <> - - {title && `${title} | `} - {seminarTitle[seminar]} - + {/* mali sme tu pred zmenou warning, musi to byt jeden text child: `A title element received an array with more than 1 element as children.` */} + {browserTitle}