diff --git a/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/ErrorMessage.tsx b/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/ErrorMessage.tsx index 7f4136ea..88d138a9 100644 --- a/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/ErrorMessage.tsx +++ b/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/ErrorMessage.tsx @@ -5,7 +5,9 @@ import { Text as JssText, RichTextField, RichText as JssRichText, + withDatasourceCheck, } from '@sitecore-jss/sitecore-jss-nextjs'; +import { ComponentProps } from 'lib/component-props'; // Define the type of props that ErrorMessage will accept interface Fields { @@ -19,12 +21,11 @@ interface Fields { StatusCode: TextField; } -export type ErrorMessageProps = { - params: { [key: string]: string }; +export type ErrorMessageProps = ComponentProps & { fields: Fields; }; -export const Default = (props: ErrorMessageProps): JSX.Element => { +const ErrorMessageComponent = (props: ErrorMessageProps): JSX.Element => { return ( { ); }; + +export const Default = withDatasourceCheck()(ErrorMessageComponent); diff --git a/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/Hero.tsx b/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/Hero.tsx index abccf113..210b9bd9 100644 --- a/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/Hero.tsx +++ b/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/Hero.tsx @@ -7,6 +7,7 @@ import { LinkField, Text as JssText, Link as JssLink, + withDatasourceCheck, } from '@sitecore-jss/sitecore-jss-nextjs'; import { ButtonLink } from '../../basics/ButtonLink'; @@ -17,6 +18,7 @@ import { } from 'lib/utils/sitecoreUtils'; import { PaddingX, Template } from 'components/Templates/LayoutConstants'; import { LayoutFlex } from 'components/Templates/LayoutFlex'; +import { ComponentProps } from 'lib/component-props'; // Define the type of props that Hero will accept interface Fields { @@ -36,12 +38,11 @@ interface Fields { Image: ImageField; } -export type HeroProps = { - params: { [key: string]: string }; +export type HeroProps = ComponentProps & { fields: Fields; }; -export const HeroHomepage = (props: HeroProps): JSX.Element => { +const HeroHomepageComponent = (props: HeroProps): JSX.Element => { return ( { ); }; -export const HeroEvent = (props: HeroProps): JSX.Element => { +export const HeroHomepage = withDatasourceCheck()(HeroHomepageComponent); + +const HeroEventComponent = (props: HeroProps): JSX.Element => { return ( <> { ); }; -export const HeroJustificationLetter = (props: HeroProps): JSX.Element => { +export const HeroEvent = withDatasourceCheck()(HeroEventComponent); + +const HeroJustificationLetterComponent = (props: HeroProps): JSX.Element => { return ( {/* Content */} @@ -200,3 +205,7 @@ export const HeroJustificationLetter = (props: HeroProps): JSX.Element => { ); }; + +export const HeroJustificationLetter = withDatasourceCheck()( + HeroJustificationLetterComponent +); diff --git a/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/Link.tsx b/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/Link.tsx index d99c73f5..7ec124d5 100644 --- a/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/Link.tsx +++ b/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/Link.tsx @@ -1,7 +1,8 @@ import React from 'react'; import { Box, Link } from '@chakra-ui/react'; import { ButtonLink } from 'src/basics/ButtonLink'; -import { LinkField, Link as JssLink } from '@sitecore-jss/sitecore-jss-nextjs'; +import { LinkField, Link as JssLink, withDatasourceCheck } from '@sitecore-jss/sitecore-jss-nextjs'; +import { ComponentProps } from 'lib/component-props'; // Define the type of props that Link will accept interface Fields { @@ -9,12 +10,11 @@ interface Fields { Link: LinkField; } -export type LinkProps = { - params: { [key: string]: string }; +export type LinkProps = ComponentProps & { fields: Fields; }; -export const Default = (props: LinkProps): JSX.Element => { +const LinkComponent = (props: LinkProps): JSX.Element => { return ( { ); }; -export const Button = (props: LinkProps): JSX.Element => { +export const Default = withDatasourceCheck()(LinkComponent); + +const LinkButton = (props: LinkProps): JSX.Element => { return ; }; + +export const Button = withDatasourceCheck()(LinkButton); diff --git a/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/TextImage.tsx b/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/TextImage.tsx index 43be6a3b..65110770 100644 --- a/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/TextImage.tsx +++ b/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/TextImage.tsx @@ -7,8 +7,10 @@ import { RichText as JssRichText, ImageField, Image as JssImage, + withDatasourceCheck, } from '@sitecore-jss/sitecore-jss-nextjs'; import { LayoutFlex } from 'components/Templates/LayoutFlex'; +import { ComponentProps } from 'lib/component-props'; // Define the type of props that TextImage will accept interface Fields { @@ -22,12 +24,11 @@ interface Fields { Image: ImageField; } -export type TextImageProps = { - params: { [key: string]: string }; +export type TextImageProps = ComponentProps & { fields: Fields; }; -export const Default = (props: TextImageProps): JSX.Element => { +const TextImageComponent = (props: TextImageProps): JSX.Element => { return ( @@ -54,3 +55,5 @@ export const Default = (props: TextImageProps): JSX.Element => { ); }; + +export const Default = withDatasourceCheck()(TextImageComponent); diff --git a/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/Venue.tsx b/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/Venue.tsx index eec9b657..33213e3d 100644 --- a/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/Venue.tsx +++ b/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/Venue.tsx @@ -6,6 +6,7 @@ import { RichText as JssRichText, Text as JssText, Item, + withDatasourceCheck, } from '@sitecore-jss/sitecore-jss-nextjs'; import { Box, Flex, Heading, Icon, Image, Stack } from '@chakra-ui/react'; import { ButtonLink } from 'src/basics/ButtonLink'; @@ -14,6 +15,7 @@ import styled from '@emotion/styled'; import { LayoutFlex } from 'components/Templates/LayoutFlex'; import { PaddingX } from 'components/Templates/LayoutConstants'; import clsx from 'clsx'; +import { ComponentProps } from 'lib/component-props'; // Define the fields that the Venue component will accept interface Fields { @@ -26,8 +28,7 @@ interface Fields { VenueImages: Item[]; } -export type VenueProps = { - params: { [key: string]: string }; +export type VenueProps = ComponentProps & { fields: Fields; }; @@ -58,7 +59,7 @@ const settings = { ), }; -export const Default = (props: VenueProps): JSX.Element => { +const VenueComponent = (props: VenueProps): JSX.Element => { const [slider, setSlider] = React.useState(null); const id = props?.params?.RenderingIdentifier || undefined; @@ -120,6 +121,8 @@ export const Default = (props: VenueProps): JSX.Element => { ); }; +export const Default = withDatasourceCheck()(VenueComponent); + interface VenueInformationBlockProps { FieldTitle: TextField; FieldText: RichTextField; diff --git a/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/VideoText.tsx b/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/VideoText.tsx index 3665bc31..25187e72 100644 --- a/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/VideoText.tsx +++ b/src/Project/Sugcon2024/Sugcon/src/components/Basic Components/VideoText.tsx @@ -5,9 +5,11 @@ import { Text as JssText, RichTextField, RichText as JssRichText, + withDatasourceCheck, } from '@sitecore-jss/sitecore-jss-nextjs'; import { isEditorActive } from '@sitecore-jss/sitecore-jss-nextjs/utils'; import { LayoutFlex } from 'components/Templates/LayoutFlex'; +import { ComponentProps } from 'lib/component-props'; // Define the type of props that VideoText will accept interface Fields { @@ -24,11 +26,10 @@ interface Fields { Text: RichTextField; } -export type VideoTextProps = { - params: { [key: string]: string }; +export type VideoTextProps = ComponentProps & { fields: Fields; }; -export const Default = (props: VideoTextProps): JSX.Element => { +const VideoTextComponent = (props: VideoTextProps): JSX.Element => { return ( @@ -71,3 +72,5 @@ export const Default = (props: VideoTextProps): JSX.Element => { ); }; + +export const Default = withDatasourceCheck()(VideoTextComponent);