From 2cec9bdef789c0705133cb41fec5ca1b3478bc89 Mon Sep 17 00:00:00 2001 From: Borghild Date: Mon, 22 Apr 2024 20:24:02 +0200 Subject: [PATCH 1/2] :art: update --- web/pageComponents/pageTemplates/Event.tsx | 10 ++-- web/pageComponents/shared/ContactList.tsx | 46 +++++++++++++++++++ .../shared/iframe/BasicIFrame.tsx | 8 +--- .../shared/portableText/Blocks.tsx | 5 +- .../portableText/components/BasicIframe.tsx | 7 +-- 5 files changed, 58 insertions(+), 18 deletions(-) diff --git a/web/pageComponents/pageTemplates/Event.tsx b/web/pageComponents/pageTemplates/Event.tsx index e436b431c..cdb4e548f 100644 --- a/web/pageComponents/pageTemplates/Event.tsx +++ b/web/pageComponents/pageTemplates/Event.tsx @@ -67,13 +67,9 @@ export default function Event({ data }: { data: EventSchema }): JSX.Element { `} > {ingress && ( - - )} - {content && ( -
- -
+ )} + {content && } )} {promotedPeople?.people && promotedPeople?.people.length > 0 && ( @@ -86,7 +82,7 @@ export default function Event({ data }: { data: EventSchema }): JSX.Element { }} /> )} - {contactList && } + {contactList && } {relatedLinks?.links && relatedLinks.links.length > 0 && ( >>>>>> 9127c9a3 (:art: update) type ContactListProps = { data: ContactListData + className?: string } +<<<<<<< HEAD const ContactList = ({ data }: ContactListProps) => { return (
+======= +const ContactList = ({ data, className = '', ...rest }: ContactListProps) => { + return ( + +>>>>>>> 9127c9a3 (:art: update) {data?.title && ( {data.title} diff --git a/web/pageComponents/shared/iframe/BasicIFrame.tsx b/web/pageComponents/shared/iframe/BasicIFrame.tsx index 72ce0f4cf..5efabd20c 100644 --- a/web/pageComponents/shared/iframe/BasicIFrame.tsx +++ b/web/pageComponents/shared/iframe/BasicIFrame.tsx @@ -15,12 +15,8 @@ const Container = styled.div` margin: auto; ` -const BasicIFrame = ({ - data: { title, frameTitle, url, cookiePolicy = 'none', designOptions }, - ...rest -}: { - data: IFrameData -}) => { +const BasicIFrame = ({ data, ...rest }: { data: IFrameData }) => { + const { title, frameTitle, url, cookiePolicy = 'none', designOptions } = data || {} if (!url) return null const { height, aspectRatio, background } = designOptions diff --git a/web/pageComponents/shared/portableText/Blocks.tsx b/web/pageComponents/shared/portableText/Blocks.tsx index 4e45826b4..f864ad929 100644 --- a/web/pageComponents/shared/portableText/Blocks.tsx +++ b/web/pageComponents/shared/portableText/Blocks.tsx @@ -9,7 +9,7 @@ import { PortableTextTypeComponent, } from '@portabletext/react' import { PortableTextBlock, PortableTextBlockStyle } from '@portabletext/types' -import { FigureWithLayout, Quote, Fact, ExternalLink, InternalLink } from './components' +import { FigureWithLayout, Quote, Fact, ExternalLink, InternalLink, BasicIframe } from './components' import { twMerge } from 'tailwind-merge' export type BlockType = Record @@ -38,6 +38,7 @@ const defaultTypes: TypesType = { positionedInlineImage: (props) => , //@ts-ignore pullQuote: (props) => , + basicIframe: (props) => , } type BlockProps = { @@ -68,7 +69,7 @@ type BlockProps = { className?: string } & PortableTextProps -const inlineBlockTypes = ['block', 'positionedInlineImage', 'pullQuote'] +const inlineBlockTypes = ['block', 'positionedInlineImage', 'pullQuote', 'basicIframe'] //@ts-ignore export default function Blocks({ diff --git a/web/pageComponents/shared/portableText/components/BasicIframe.tsx b/web/pageComponents/shared/portableText/components/BasicIframe.tsx index 80ddad96d..dba575af6 100644 --- a/web/pageComponents/shared/portableText/components/BasicIframe.tsx +++ b/web/pageComponents/shared/portableText/components/BasicIframe.tsx @@ -4,6 +4,7 @@ import type { PortableTextBlock } from '@portabletext/types' import type { IFrameData } from 'types/types' import styled from 'styled-components' import RichText from '../RichText' +import { twMerge } from 'tailwind-merge' type IframeRenderer = { _key: string @@ -11,16 +12,16 @@ type IframeRenderer = { } & IFrameData const Container = styled.div` - margin: var(--space-xxLarge) auto; clear: both; ` type BlockProps = { isInline: boolean value: IframeRenderer + className?: string } & PortableTextBlock export const BasicIframe = (iframe: BlockProps) => { - const { value } = iframe + const { value, className = '' } = iframe const data = { ...value, type: value._type, @@ -28,7 +29,7 @@ export const BasicIframe = (iframe: BlockProps) => { } return ( - + {value.title && }