From 158892bd3e996f31ae634180da9f53c5f54f97df Mon Sep 17 00:00:00 2001 From: Pier-Paolo Mammi Date: Mon, 6 Jul 2026 11:41:27 +0200 Subject: [PATCH] refactor: move template rendering to own properties and functions --- .../common/src/ElixFormsComponentAbstract.tsx | 96 ++++++++++++++++--- .../src/IElixFormsComponentProperties.ts | 6 ++ react/scelta-carriera/src/App.jsx | 90 +++-------------- .../src/SceltaCarrieraComponent.tsx | 4 + 4 files changed, 107 insertions(+), 89 deletions(-) diff --git a/react/common/src/ElixFormsComponentAbstract.tsx b/react/common/src/ElixFormsComponentAbstract.tsx index 474a425..d4bc634 100644 --- a/react/common/src/ElixFormsComponentAbstract.tsx +++ b/react/common/src/ElixFormsComponentAbstract.tsx @@ -113,6 +113,10 @@ export default abstract class ElixFormsComponentAbstract extends Component { const { description, @@ -120,23 +124,91 @@ export default abstract class ElixFormsComponentAbstract extends Component - {/* className={`${styles.elixFormsReact} ${hasTeamsContext ? styles.teams : ''}`} */} -
{environmentMessage}
-
{description}
-
- {this.createMandatoryFormFields(queryParams)} - {this.createAdditionalFormFields()} - {this.renderCustomFormFields()} - -
- +
+
+
+
+
+
+
+
+

elixForms

+
Logo Università: di Parma +
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+ {moduleTitle && ( +
+
+

{moduleTitle}

+
+
+ )} +
+
+ {pageTitle &&

{pageTitle}

} + {heroImageSrc && Hero Image} + {pageDescription &&

{pageDescription}

} + + {environmentMessage &&
{environmentMessage}
} + {description &&
{description}
} + +
+ {this.createMandatoryFormFields(queryParams)} + {this.createAdditionalFormFields()} + {this.renderCustomFormFields()} + +
+ + {this.renderExtraContent()} +
+
+
+
+ +
+ +
+
+
+
+
+
+
powered by elixForms
+
versione 1.24.0
+
+
+
+
+
+
+
+
+
+
); } diff --git a/react/common/src/IElixFormsComponentProperties.ts b/react/common/src/IElixFormsComponentProperties.ts index a8771f0..8b39049 100644 --- a/react/common/src/IElixFormsComponentProperties.ts +++ b/react/common/src/IElixFormsComponentProperties.ts @@ -8,6 +8,12 @@ export interface IElixFormsComponentProperties { hasTeamsContext: boolean; userDisplayName: string; additionalFieldsJson?: string; + + // Layout Properties + moduleTitle?: string; + pageTitle?: string; + pageDescription?: string; + heroImageSrc?: string; } // Additional Fields JSON Schema diff --git a/react/scelta-carriera/src/App.jsx b/react/scelta-carriera/src/App.jsx index 5fe2af9..e6a4791 100644 --- a/react/scelta-carriera/src/App.jsx +++ b/react/scelta-carriera/src/App.jsx @@ -8,83 +8,19 @@ import SceltaCarrieraComponent from './SceltaCarrieraComponent'; function App() { const [count, setCount] = useState(0) - /** @type {SceltaCarrieraComponent} */ - var myElixFormsReact = new SceltaCarrieraComponent({ - description: "This is a custom form created with ElixFormsReact component.", - isDarkTheme: false, - environmentMessage: "TESTING!", - hasTeamsContext: false, - userDisplayName: "John Doe", - }); - - var elixFormsReactRender = myElixFormsReact.render(); - - return <> -
-
-
-
-
-
-
-
-

elixForms

-
Logo Università: di Parma -
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-

Modulo A/13 - Richiesta di Certificato

-
-
-
-
-

Scelta Carriera

- Hero Image -

Benvenuto nella piattaforma di scelta carriera! Esplora le tue opzioni e trova la strada giusta per te.

- {elixFormsReactRender} -

Altre cose

-
-
-
-
- -
- -
-
-
-
-
-
-
powered by elixForms
-
versione 1.24.0
-
-
-
-
-
-
-
-
-
-
- ; - + return ( + + ); } export default App diff --git a/react/scelta-carriera/src/SceltaCarrieraComponent.tsx b/react/scelta-carriera/src/SceltaCarrieraComponent.tsx index 4eac28a..20c6316 100644 --- a/react/scelta-carriera/src/SceltaCarrieraComponent.tsx +++ b/react/scelta-carriera/src/SceltaCarrieraComponent.tsx @@ -42,4 +42,8 @@ export default class SceltaCarrieraComponent extends ElixFormsComponentAbstract ); } + + protected override renderExtraContent(): JSX.Element { + return

Altre cose

; + } }