Merge branch 'home-banners-dashboard' of WrenchBoard/Users-Wrench into master
This commit is contained in:
@@ -1,6 +1,18 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
const AccountDashboard = ({ className }) => {
|
const AccountDashboard = ({ className, bannerList }) => {
|
||||||
|
const getUpperBanner = bannerList?.slice(0, 3);
|
||||||
|
|
||||||
|
let getImage = ({banner_location, banner}) => {
|
||||||
|
if (banner_location == "LOCAL") {
|
||||||
|
return require(`../../assets/images/${banner}`);
|
||||||
|
} else {
|
||||||
|
return banner;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log(getUpperBanner);
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`w-full min-h-[450px] flex flex-col justify-between items-center gap-4 rounded-2xl overflow-hidden ${
|
className={`w-full min-h-[450px] flex flex-col justify-between items-center gap-4 rounded-2xl overflow-hidden ${
|
||||||
@@ -8,11 +20,26 @@ const AccountDashboard = ({ className }) => {
|
|||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<div className="w-full h-[300px] md:grid grid-cols-3 items-center justify-center gap-2">
|
<div className="w-full h-[300px] md:grid grid-cols-3 items-center justify-center gap-2">
|
||||||
<TopBanner />
|
{getUpperBanner?.map((props, idx) => {
|
||||||
<TopBanner />
|
|
||||||
<TopBanner />
|
let image = getImage(props);
|
||||||
|
|
||||||
|
let { short_title, short_description, button_text, link_path } =
|
||||||
|
props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TopBanner
|
||||||
|
btn={button_text}
|
||||||
|
image={image}
|
||||||
|
title={short_title}
|
||||||
|
desc={short_description}
|
||||||
|
link_path={link_path}
|
||||||
|
key={idx}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full h-[150px] md:grid grid-cols-2 items-center justify-center gap-4">
|
<div className="w-full h-[150px] md:grid grid-cols-2 items-center justify-center gap-4 ">
|
||||||
<LowerBanner />
|
<LowerBanner />
|
||||||
<LowerBanner />
|
<LowerBanner />
|
||||||
</div>
|
</div>
|
||||||
@@ -22,24 +49,29 @@ const AccountDashboard = ({ className }) => {
|
|||||||
|
|
||||||
export default AccountDashboard;
|
export default AccountDashboard;
|
||||||
|
|
||||||
const TopBanner = () => {
|
const TopBanner = ({ image, title = "", desc = "", btn, link_path, key }) => {
|
||||||
let Image = require(`../../assets/images/offer.jpg`);
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col shadow-md rounded-xl">
|
<div className="flex flex-col shadow-md rounded-xl">
|
||||||
<div className="h-[12rem] rounded-t-xl">
|
<Link to={link_path} key={key} className="h-[12rem] rounded-t-xl">
|
||||||
<img
|
<img
|
||||||
src={Image}
|
src={image}
|
||||||
alt="banner-img"
|
alt="banner-img"
|
||||||
className="w-full h-full rounded-t-xl"
|
className="w-full h-full rounded-t-xl object-cover"
|
||||||
/>
|
/>
|
||||||
</div>
|
</Link>
|
||||||
<div className="h-[7rem] rounded-b-xl bg-white">
|
<div className="h-[7rem] rounded-b-xl bg-white">
|
||||||
<div className="border-b border-slate-300 px-2 py-1 h-[5.4rem]">
|
<div className="border-b border-slate-300 px-2 py-1 h-[5.4rem]">
|
||||||
<h3 className="font-bold text-lg">Banner Title</h3>
|
<Link to={link_path} className="font-bold text-lg">
|
||||||
<p>Banner description text will come follow</p>
|
{title}
|
||||||
|
</Link>
|
||||||
|
<Link to={link_path} className="text-sm">
|
||||||
|
{desc}
|
||||||
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-between w-full px-2 items-center">
|
<div className="flex justify-between w-full px-2 items-center">
|
||||||
<span className="text-slate-300 font-semibold">follow up text</span>
|
<Link to={link_path} className="text-slate-300 font-semibold">
|
||||||
|
{btn}
|
||||||
|
</Link>
|
||||||
<button className="flex items-center justify-center gap-2">
|
<button className="flex items-center justify-center gap-2">
|
||||||
<div className="w-[4px] h-[4px] bg-slate-400 rounded-full"></div>
|
<div className="w-[4px] h-[4px] bg-slate-400 rounded-full"></div>
|
||||||
<div className="w-[4px] h-[4px] bg-slate-400 rounded-full"></div>
|
<div className="w-[4px] h-[4px] bg-slate-400 rounded-full"></div>
|
||||||
@@ -48,10 +80,10 @@ const TopBanner = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const LowerBanner = () => {
|
const LowerBanner = ({ image, title = "", desc = "", btn, link_path, key }) => {
|
||||||
let Image = require(`../../assets/images/offer.jpg`);
|
let Image = require(`../../assets/images/offer.jpg`);
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col bg-white shadow-md h-full rounded-xl">
|
<div className="flex flex-col bg-white shadow-md h-full rounded-xl">
|
||||||
|
|||||||
@@ -59,13 +59,11 @@ export default function FullAccountDash(props) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(process.env.REACT_APP_SHOW_ACCOUNT_DASH)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="home-page-wrapper">
|
<div className="home-page-wrapper">
|
||||||
{process.env.REACT_APP_SHOW_ACCOUNT_DASH == "1" && (
|
{process.env.REACT_APP_SHOW_ACCOUNT_DASH == "1" && (
|
||||||
<AccountDashboard className="mb-4" />
|
<AccountDashboard className="mb-4" bannerList={props.bannerList} />
|
||||||
)}
|
)}
|
||||||
{renderDashboard()}
|
{renderDashboard()}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user