From 45e0d77f384fcfcd899238918a56e71181040fad Mon Sep 17 00:00:00 2001
From: esikkala <esko.ikkala@aalto.fi>
Date: Tue, 1 Feb 2022 12:47:44 +0200
Subject: [PATCH] Update main page config

---
 .../components/perspectives/sampo/Main.js     | 24 ++++++++++---------
 src/configs/portalConfig.json                 |  3 ++-
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/src/client/components/perspectives/sampo/Main.js b/src/client/components/perspectives/sampo/Main.js
index 56db65f0..6210ed97 100644
--- a/src/client/components/perspectives/sampo/Main.js
+++ b/src/client/components/perspectives/sampo/Main.js
@@ -12,7 +12,8 @@ import { getSpacing } from '../../../helpers/helpers'
  * A component for generating a front page for a semantic portal.
  */
 const Main = props => {
-  const { perspectives, screenSize } = props
+  const { perspectives, screenSize, layoutConfig } = props
+  const { mainPage } = layoutConfig
   let headingVariant = 'h5'
   let subheadingVariant = 'body1'
   let descriptionVariant = 'body1'
@@ -47,7 +48,6 @@ const Main = props => {
   return (
     <Box
       sx={theme => {
-        const { layoutConfig } = props
         const defaultHeightReduction = layoutConfig.topBar.defaultHeight +
           layoutConfig.footer.defaultHeight + getSpacing(theme, 2)
         const reducedHeightReduction = layoutConfig.topBar.reducedHeight +
@@ -66,16 +66,16 @@ const Main = props => {
     >
       <Box
         sx={theme => ({
-          background: props.layoutConfig.mainPage.bannerBackround,
+          background: mainPage.bannerBackround,
           backgroundRepeat: 'no-repeat',
           backgroundSize: 'cover',
           backgroundPosition: 'center',
-          height: props.layoutConfig.mainPage.bannerMobileHeight,
+          height: mainPage.bannerMobileHeight,
           [theme.breakpoints.up('md')]: {
-            height: props.layoutConfig.mainPage.bannerReducedHeight
+            height: mainPage.bannerReducedHeight
           },
           [theme.breakpoints.up('xl')]: {
-            height: props.layoutConfig.mainPage.bannerDefaultHeight
+            height: mainPage.bannerDefaultHeight
           },
           boxShadow: '0 -15px 15px 0px #bdbdbd inset',
           display: 'flex',
@@ -101,11 +101,13 @@ const Main = props => {
           <Box
             sx={theme => ({
               marginTop: theme.spacing(1.5),
-              [theme.breakpoints.up('md')]: {
-                display: 'flex',
-                '& div': {
-                  flexGrow: 1,
-                  width: 0
+              ...(mainPage.wrapSubheading) && {
+                [theme.breakpoints.up('md')]: {
+                  display: 'flex',
+                  '& div': {
+                    flexGrow: 1,
+                    width: 0
+                  }
                 }
               }
             })}
diff --git a/src/configs/portalConfig.json b/src/configs/portalConfig.json
index 6618e181..d680ae91 100644
--- a/src/configs/portalConfig.json
+++ b/src/configs/portalConfig.json
@@ -91,7 +91,8 @@
             "bannerBackround": "linear-gradient( rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45) ), url(<BANNER_IMAGE_URL)",
             "bannerMobileHeight": 150,
             "bannerReducedHeight": 220,
-            "bannerDefaultHeight": 300
+            "bannerDefaultHeight": 300,
+            "wrapSubheading": true
         },
         "infoHeader": {
             "default": {
-- 
GitLab