From 3403210fe8d1bf3cdbd2ed9b571c7fc550f019e9 Mon Sep 17 00:00:00 2001 From: Ebube Date: Tue, 27 Feb 2024 11:36:53 +0100 Subject: [PATCH] Populated the lower component --- .../Dashboards/AccountDashboard.jsx | 127 +++++++++++++++--- .../Dashboards/FamilyParentDashboard.jsx | 5 - src/components/Dashboards/HomeDashboard.jsx | 5 - 3 files changed, 107 insertions(+), 30 deletions(-) diff --git a/src/components/Dashboards/AccountDashboard.jsx b/src/components/Dashboards/AccountDashboard.jsx index 75dc622..0394d8c 100644 --- a/src/components/Dashboards/AccountDashboard.jsx +++ b/src/components/Dashboards/AccountDashboard.jsx @@ -2,9 +2,11 @@ import React from "react"; import { Link } from "react-router-dom"; const AccountDashboard = ({ className, bannerList }) => { - const getUpperBanner = bannerList?.slice(0, 3); + // getting the upper three banners for the home layout + const getUpperBanner = bannerList?.filter((value, idx) => idx <= 2); + const getLowerBanner = bannerList?.filter((value, idx) => idx > 2); - let getImage = ({banner_location, banner}) => { + let getImage = ({ banner_location, banner }) => { if (banner_location == "LOCAL") { return require(`../../assets/images/${banner}`); } else { @@ -12,7 +14,7 @@ const AccountDashboard = ({ className, bannerList }) => { } }; - console.log(getUpperBanner); + console.log(getLowerBanner); return (
{ >
{getUpperBanner?.map((props, idx) => { - let image = getImage(props); - let { short_title, short_description, button_text, link_path } = + let { short_title, short_description, short_button_text, link_path } = props; return ( { })}
- - + {getLowerBanner?.map((props, idx) => { + let image = getImage(props); + + let { short_title, short_description, short_button_text, link_path } = + props; + + return ( + + ); + })}
); @@ -60,7 +76,7 @@ const TopBanner = ({ image, title = "", desc = "", btn, link_path, key }) => { />
-
+
{title} @@ -80,30 +96,38 @@ const TopBanner = ({ image, title = "", desc = "", btn, link_path, key }) => {
- ); + ); }; -const LowerBanner = ({ image, title = "", desc = "", btn, link_path, key }) => { - let Image = require(`../../assets/images/offer.jpg`); +const LowerBanner = ({ image, title = "", desc = "", btn, link_path, key }) => { return ( -
+
-
-

Banner Title

-

Banner description text will come follow

+
+ + {title} + +

+ {desc} +

-
+ banner-img -
+
- follow up text + + {btn} +
); }; + +const BannerSection = ({ banners, variant }) => { + const getImage = ({ banner_location, banner }) => { + return banner_location === "LOCAL" + ? require(`../../assets/images/${banner}`) + : banner; + }; + + return ( + <> + {banners?.map((props, idx) => { + const { short_title, short_description, short_button_text, link_path } = + props; + const image = getImage(props); + + return ( +
+
+ + banner-img + +
+
+
+ + {short_title} + + + {short_description} + +
+
+ + {short_button_text} + + +
+
+
+ ); + })} + + ); +}; diff --git a/src/components/Dashboards/FamilyParentDashboard.jsx b/src/components/Dashboards/FamilyParentDashboard.jsx index 8440181..dbd5ccb 100644 --- a/src/components/Dashboards/FamilyParentDashboard.jsx +++ b/src/components/Dashboards/FamilyParentDashboard.jsx @@ -93,11 +93,6 @@ export default function FamilyParentDashboard({ className, bannerList, nextDueTa
-
); } diff --git a/src/components/Dashboards/HomeDashboard.jsx b/src/components/Dashboards/HomeDashboard.jsx index 9c45836..ab6db00 100644 --- a/src/components/Dashboards/HomeDashboard.jsx +++ b/src/components/Dashboards/HomeDashboard.jsx @@ -93,11 +93,6 @@ export default function HomeDashboard({ className, bannerList, nextDueTask }) { - ); }