Skip to content

Commit

Permalink
BrowseHome refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
lnxfsf committed Jan 14, 2024
1 parent 510bb51 commit e5f7c30
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 47 deletions.
40 changes: 40 additions & 0 deletions frontend/src/components/Home/BrowseHome/BrowseHome.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import "../../../styles/BrowseHome.scoped.scss";


import React, { useContext } from "react";
import AuthContext from "../../../context/AuthContext";

import { Filter } from "./Filter";
import { Items } from "./Items";

const BrowseHome = () => {
const { user } = useContext(AuthContext);

return (
<>
<div className="main2 flex justify-center items-center ">

<div className="basis-1/4">


{/* filter */}
<Filter />

</div>

<div className="cards_container grow p-14">

{/* other one */}


<Items />



</div>
</div>
</>
);
};

export { BrowseHome };
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
import "../../styles/BrowseHome.scoped.scss";

import { Link } from "react-router-dom";
import { anime_data, genres, year, studio } from "../../../data";
import "../../../styles/BrowseHome.scoped.scss";

import React, { useContext } from "react";
import AuthContext from "../../context/AuthContext";

// data
import { anime_data, genres, year, studio } from "../../data";
const Filter = () => {

const BrowseHome = () => {
const { user } = useContext(AuthContext);

return (
<>
<div className="main2 flex justify-center items-center ">

return <>

{/*
// TODO , and with data we get in search, we need to pass and send it to BE. but dont bother. wait first BE to finish what they have ...
*/}
<div className="basis-1/4">


<div className="filter flex flex-col border-2 border-pinky m-6 ">
<h1 className="self-center m-4 mt-8 ">Browse</h1>

Expand Down Expand Up @@ -87,37 +83,8 @@ const BrowseHome = () => {
Submit
</button>
</div>
</div>

<div className="cards_container grow p-14">
<div className=" grid grid-cols-4 gap-x-6 gap-y-6 grow ">
{/*individual card. for anime it shows */}
{anime_data.map((item) => (
<Link
to="/detailspage"
state={{ id: item.anime_id, anime: true }}
key={item.anime_id}
>
<div className="card">
<div className="card_img">
<img src={item.image} />
</div>

<div className="flex flex-row gap-x-2 mt-3">
{/* check index.css, for global use, vertical rectangle.. */}

<p className="title8 secondary-left-line">{item.title}</p>

{/*TODO you add favorite button, and for it to work properly */}
</div>
</div>
</Link>
))}
</div>
</div>
</div>
</>
);
};

</>
}

export { BrowseHome };
export {Filter};
42 changes: 42 additions & 0 deletions frontend/src/components/Home/BrowseHome/Items.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

import { anime_data, genres, year, studio } from "../../../data";
import "../../../styles/BrowseHome.scoped.scss";

import { Link } from "react-router-dom";

const Items = () => {



return <>

<div className=" grid grid-cols-4 gap-x-6 gap-y-6 grow ">

{/*individual card. for anime it shows */}
{anime_data.map((item) => (
<Link
to="/detailspage"
state={{ id: item.anime_id, anime: true }}
key={item.anime_id}
>
<div className="card">
<div className="card_img">
<img src={item.image} />
</div>

<div className="flex flex-row gap-x-2 mt-3">
{/* check index.css, for global use, vertical rectangle.. */}

<p className="title8 secondary-left-line">{item.title}</p>

{/*TODO you add favorite button, and for it to work properly */}
</div>
</div>
</Link>
))}
</div>

</>
}

export {Items};
2 changes: 1 addition & 1 deletion frontend/src/pages/Home.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PopularCarousel } from "../components/Home/PopularCarousel/PopularCarousel";
import { UpcomingCarousel } from "../components/Home/UpcomingCarousel";
import { BrowseHome } from "../components/Home/BrowseHome";
import { BrowseHome } from "../components/Home/BrowseHome/BrowseHome";

const Home = () => {
return (
Expand Down

0 comments on commit e5f7c30

Please sign in to comment.