Skip to content

Commit

Permalink
Updated landing page data distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
mansisindhu committed Dec 22, 2021
1 parent 074362c commit 7fa2326
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
19 changes: 15 additions & 4 deletions src/components/LandingPageComponents/CarouselMain/CarouselMain.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,23 @@ import "./carousel.css";
import "./card.module.css";
import styles from "./card.module.css";

const titles = [
"Ancestors: The Humankind Odyssey",
"Manifold Garden",
"Prey",
"Rebel Galaxy",
"Wolfenstein: The Old Blood",
"Battlefield™ 2042",
];

const CarouselMain = () => {
const data = useSelector((state) => state.landingPageData);
const carouselData = [];
for (let i = 0; i < 6; i++) {
carouselData.push(data[i]);
}
const carouselData = data.filter((el) => {
if (titles.includes(el.title)) {
return el;
}
return false;
});

return (
<div className={styles.main}>
Expand Down
22 changes: 16 additions & 6 deletions src/pages/LandingPage/LandingPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ const LandingPage = () => {
const mostPopularData = landingPageData.slice(10, 15);
const newToStoreData = landingPageData.slice(15, 20);

const secondaryCardData1 = landingPageData.filter((el) => {
if (el.title === "Corruption 2029" || el.title === "Anno 1701") {
return el;
}
return false;
});

const secondaryCardData2 = landingPageData.filter((el) => {
if (el.title === "Tribes of Midgard" || el.title === "One Hand Clapping") {
return el;
}
return false;
});

return (
<>
<Header />
Expand All @@ -38,9 +52,7 @@ const LandingPage = () => {
</div>

<div className={styles.secondaryCardContainer}>
<SecondaryCardContainer
data={[landingPageData[24], landingPageData[25]]}
/>
<SecondaryCardContainer data={secondaryCardData1} />
</div>

<div className={styles.freeCardContainer}>
Expand Down Expand Up @@ -68,9 +80,7 @@ const LandingPage = () => {
</div>

<div className={styles.secondaryCardContainer}>
<SecondaryCardContainer
data={[landingPageData[20], landingPageData[19]]}
/>
<SecondaryCardContainer data={secondaryCardData2} />
</div>

<div className={styles.mainCardContainer}>
Expand Down

1 comment on commit 7fa2326

@vercel
Copy link

@vercel vercel bot commented on 7fa2326 Dec 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.