diff --git a/.changeset/rich-tigers-build.md b/.changeset/rich-tigers-build.md new file mode 100644 index 000000000..487982e87 --- /dev/null +++ b/.changeset/rich-tigers-build.md @@ -0,0 +1,5 @@ +--- +"nextjs-website": patch +--- + +add background image to form diff --git a/apps/nextjs-website/react-components/components/Form/Form.tsx b/apps/nextjs-website/react-components/components/Form/Form.tsx index fe24578af..873eceb0c 100644 --- a/apps/nextjs-website/react-components/components/Form/Form.tsx +++ b/apps/nextjs-website/react-components/components/Form/Form.tsx @@ -43,6 +43,7 @@ const Form = ({ sectionID, buttonLabel, notes, + background, }: FormProps) => { const textColor = TextColor(theme); const graylinkColor = GrayLinkColor(theme); @@ -249,156 +250,166 @@ const Form = ({ return ( - - - {title} - - {subtitle && ( + - {subtitle} + {title} - )} - - {inputFields.map(InputField)} - - {categoriesTitle && categories.length > 0 && ( + {subtitle && ( + + {subtitle} + + )} + + {inputFields.map(InputField)} + + {categoriesTitle && categories.length > 0 && ( + + {categoriesTitle} + + )} + {categories.length > 0 && ( + + )} - {categoriesTitle} + *Campo obbligatorio - )} - {categories.length > 0 && ( - - )} - - *Campo obbligatorio - - - {submissionStatus === 'success' && ( - - Grazie! La tua richiesta è stata registrata - - )} - {submissionStatus === 'failure' && ( - - Purtroppo in questo momento non è possibile registrare la tua - richiesta - - )} - {notes && ( - + {submissionStatus === 'success' && ( + + Grazie! La tua richiesta è stata registrata + + )} + {submissionStatus === 'failure' && ( + + Purtroppo in questo momento non è possibile registrare la tua + richiesta + + )} + {notes && ( + - {notes} - - )} + }} + > + {notes} + + )} - + + ); }; diff --git a/apps/nextjs-website/react-components/types/Form/Form.types.ts b/apps/nextjs-website/react-components/types/Form/Form.types.ts index e32f9d9d0..fd00a1978 100644 --- a/apps/nextjs-website/react-components/types/Form/Form.types.ts +++ b/apps/nextjs-website/react-components/types/Form/Form.types.ts @@ -24,6 +24,7 @@ export interface FormProps extends SectionProps, FormFields, FormCategories { readonly recaptchaSiteKey: string; readonly buttonLabel: string; readonly notes?: JSX.Element; + readonly background?: string; } export interface FormData { diff --git a/apps/nextjs-website/src/components/Form.tsx b/apps/nextjs-website/src/components/Form.tsx index 0c6879ad7..6d0d7741a 100644 --- a/apps/nextjs-website/src/components/Form.tsx +++ b/apps/nextjs-website/src/components/Form.tsx @@ -10,6 +10,7 @@ const makeFormProps = ({ categoriesTitle, buttonLabel, notes, + background, ...rest }: FormSection): FormProps => ({ categories: categories.map(({ additionalInfo, ...category }) => ({ @@ -20,6 +21,7 @@ const makeFormProps = ({ ...(categoriesTitle && { categoriesTitle }), buttonLabel, ...(notes && { notes: MarkdownRenderer({ markdown: notes }) }), + ...(background.data && { background: background.data.attributes.url }), ...rest, }); diff --git a/apps/nextjs-website/src/lib/fetch/types/PageSection.ts b/apps/nextjs-website/src/lib/fetch/types/PageSection.ts index ea62d4950..544c63c5e 100644 --- a/apps/nextjs-website/src/lib/fetch/types/PageSection.ts +++ b/apps/nextjs-website/src/lib/fetch/types/PageSection.ts @@ -200,6 +200,7 @@ const FormSectionCodec = t.strict({ sectionID: t.union([t.string, t.null]), buttonLabel: t.string, notes: t.union([t.string, t.null]), + background: StrapiImageSchema, }); const CounterCodec = t.strict({