From d3ba55f7453005319b7afbd3ad726dad4523a781 Mon Sep 17 00:00:00 2001 From: anbrue Date: Thu, 29 Feb 2024 19:55:11 +0100 Subject: [PATCH] formatted for the happiness of prettier --- .../Basic Components/ActionBanner.tsx | 21 ++++-- .../Sugcon/src/components/Events/Agenda.tsx | 72 +++++++++---------- 2 files changed, 51 insertions(+), 42 deletions(-) diff --git a/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/ActionBanner.tsx b/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/ActionBanner.tsx index ac876a86..86ca45a3 100644 --- a/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/ActionBanner.tsx +++ b/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/ActionBanner.tsx @@ -1,5 +1,10 @@ import React from 'react'; -import { Field, Link as JssLink, LinkField, Text as JssText } from '@sitecore-jss/sitecore-jss-nextjs'; +import { + Field, + Link as JssLink, + LinkField, + Text as JssText, +} from '@sitecore-jss/sitecore-jss-nextjs'; interface Fields { Title: Field; @@ -27,9 +32,17 @@ export const Default = (props: ActionBannerProps): JSX.Element => { return (
-

-
-
+
+

+ +

+
+
+ +
+
+ +
); diff --git a/src/Project/Sugcon2024/Sugcon/src/components/Events/Agenda.tsx b/src/Project/Sugcon2024/Sugcon/src/components/Events/Agenda.tsx index 79a179c5..e8727043 100644 --- a/src/Project/Sugcon2024/Sugcon/src/components/Events/Agenda.tsx +++ b/src/Project/Sugcon2024/Sugcon/src/components/Events/Agenda.tsx @@ -3,52 +3,48 @@ import { Field } from '@sitecore-jss/sitecore-jss-nextjs'; import useSWR from 'swr'; interface Fields { - SessionizeUrl: Field; + SessionizeUrl: Field; } type AgendaProps = { - params: { [key: string]: string }; - fields: Fields; + params: { [key: string]: string }; + fields: Fields; }; const AgendaDefaultComponent = (props: AgendaProps): JSX.Element => ( -
-
- Agenda -
+
+
+ Agenda
+
); export const Default = (props: AgendaProps): JSX.Element => { - const id = props.params.RenderingIdentifier; - - if (!props?.fields?.SessionizeUrl?.value) { - return ; - } - - //Question: linter is saying the hook shouldn't be called conditionally, but that's correct in this case? - //eslint-disable-next-line - const { data, error } = useSWR(props.fields.SessionizeUrl.value, () => fetch(props.fields.SessionizeUrl.value).then((response) => response.text())); - - //TODO: design error - if (error) { - return ( -
Failed to load...
- ); - } - - //TODO: design loading - if (!data) { - return ( -
Loading
- ); - } - - return ( -
-
-
-
-
- ); + const id = props.params.RenderingIdentifier; + + if (!props?.fields?.SessionizeUrl?.value) { + return ; + } + + //Question: linter is saying the hook shouldn't be called conditionally, but that's correct in this case? + //eslint-disable-next-line + const { data, error } = useSWR(props.fields.SessionizeUrl.value, () => fetch(props.fields.SessionizeUrl.value).then((response) => response.text())); + + //TODO: design error + if (error) { + return
Failed to load...
; + } + + //TODO: design loading + if (!data) { + return
Loading
; + } + + return ( +
+
+
+
+
+ ); };