diff --git a/src/core_modules/capture-core/components/Pages/common/EnrollmentOverviewDomain/EnrollmentPageLayout/DefaultEnrollmentLayout.types.js b/src/core_modules/capture-core/components/Pages/common/EnrollmentOverviewDomain/EnrollmentPageLayout/DefaultEnrollmentLayout.types.js index 218d77fa41..922a2071fc 100644 --- a/src/core_modules/capture-core/components/Pages/common/EnrollmentOverviewDomain/EnrollmentPageLayout/DefaultEnrollmentLayout.types.js +++ b/src/core_modules/capture-core/components/Pages/common/EnrollmentOverviewDomain/EnrollmentPageLayout/DefaultEnrollmentLayout.types.js @@ -34,6 +34,7 @@ export type ColumnConfig = DefaultWidgetColumnConfig | PluginWidgetColumnConfig; export type PageLayoutConfig = { title?: ?string, + backgroundColor?: ?string, leftColumn: ?Array, rightColumn: ?Array, } diff --git a/src/core_modules/capture-core/components/Pages/common/EnrollmentOverviewDomain/EnrollmentPageLayout/EnrollmentPageLayout.js b/src/core_modules/capture-core/components/Pages/common/EnrollmentOverviewDomain/EnrollmentPageLayout/EnrollmentPageLayout.js index d3f18557ff..f6d821e872 100644 --- a/src/core_modules/capture-core/components/Pages/common/EnrollmentOverviewDomain/EnrollmentPageLayout/EnrollmentPageLayout.js +++ b/src/core_modules/capture-core/components/Pages/common/EnrollmentOverviewDomain/EnrollmentPageLayout/EnrollmentPageLayout.js @@ -10,6 +10,7 @@ import { DefaultPageTitle, EnrollmentPageKeys } from './DefaultEnrollmentLayout. const getEnrollmentPageStyles = () => ({ container: { + minHeight: '90vh', padding: '16px 24px 16px 24px', }, contentContainer: { @@ -44,6 +45,9 @@ const getEnrollmentPageStyles = () => ({ }, }); +// Function to validate hex color +const isValidHex = (color: string) => /^#[0-9A-F]{6}$/i.test(color); + const getTitle = (inputTitle, page) => { const title = inputTitle || i18n.t('Enrollment'); const titles = { @@ -83,8 +87,13 @@ const EnrollmentPageLayoutPlain = ({ props: allProps, }); + const containerStyle = useMemo(() => { + if (!pageLayout.backgroundColor || !isValidHex(pageLayout.backgroundColor)) return undefined; + return { backgroundColor: pageLayout.backgroundColor }; + }, [pageLayout.backgroundColor]); + return ( -
+
+