Skip to content

Commit

Permalink
Anime refactored
Browse files Browse the repository at this point in the history
Note: probably you'll need to have one component for all those 3 parts, Anime, Explore, Manga.
They just have little variations, check what are those..

This will serve well, with responsive design, as it will go somewhat cleaner, there's still work to do.
  • Loading branch information
lnxfsf committed Jan 14, 2024
1 parent e5f7c30 commit c660661
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 126 deletions.
37 changes: 37 additions & 0 deletions frontend/src/components/Anime/BrowseAnime.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import "../../styles/Anime.scoped.scss";

import { anime_data, genres, year, studio, season, episodes } from "../../data";
import { Link } from "react-router-dom";

const BrowseAnime = () => {
return (
<>
<div className=" cards_container1 grid grid-cols-6 gap-x-6 gap-y-6 p-6 ">
{anime_data.map((item) => (
<Link
to="/detailspage"
state={{ id: item.anime_id, anime: true }}
key={item.anime_id}
>
<div className="card">
<div className="card_img1">
<img src={item.image} />
</div>

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

<p className="title8">{item.title}</p>

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

export { BrowseAnime };
113 changes: 113 additions & 0 deletions frontend/src/components/Anime/FilterSearch.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import "../../styles/Anime.scoped.scss";

import { anime_data, genres, year, studio, season, episodes } from "../../data";

const FilterSearch = () => {
return <>


<div className="filter1 grid grid-cols-6 p-6 ">
<div className="flex flex-col justify-start ml-3 mt-3">
<p className="filter_txt1">Search:</p>

<div className="search-container">
<div className="input-container1">
<input type="text" placeholder="Search" />
<button className="search-icon">
<i className="bx bx-search-alt-2"></i>
</button>
</div>
</div>
</div>

<div className="flex flex-col justify-start ml-3 mt-3">
<p className="filter_txt1">Genres:</p>

<select className="dropdown-select_g1" multiple>
{/* all genres possible */}

{genres.map((item, index) => (
<option value={item} key={index}>
{item}
</option>
))}
</select>
</div>

<div className="flex flex-col justify-start ml-3 mt-3">
<p className="filter_txt1">Year:</p>

<select className="dropdown-select1">
<option disabled selected>
Year
</option>
{/* years from 1940 to 2023 */}

{year.map((item, index) => (
<option value={item} key={index}>
{item}
</option>
))}
</select>
</div>

<div className="flex flex-col justify-start ml-3 mt-3">
<p className="filter_txt1">Studio:</p>

<select className="dropdown-select1">
<option selected disabled>
Studio
</option>

{/* choose studios */}

{studio.map((item, index) => (
<option value={item} key={index}>
{item}
</option>
))}
</select>
</div>

<div className="flex flex-col justify-start ml-3 mt-3">
<p className="filter_txt1">Seasons:</p>

<select className="dropdown-select1">
<option selected disabled>
Seasons
</option>

{/* choose studios */}

{season.map((item, index) => (
<option value={item} key={index}>
{item}
</option>
))}
</select>
</div>

<div className="flex flex-col justify-start ml-3 mt-3">
<p className="filter_txt1">Episodes:</p>

<select className="dropdown-select1">
<option selected disabled>
Episodes
</option>

{/* choose studios */}

{episodes.map((item, index) => (
<option value={item} key={index}>
{item}
</option>
))}
</select>
</div>
</div>


</>;
};

export { FilterSearch };
132 changes: 6 additions & 126 deletions frontend/src/pages/Anime.jsx
Original file line number Diff line number Diff line change
@@ -1,137 +1,17 @@
import "../styles/Anime.scoped.scss";
import { Link } from "react-router-dom";

// data
import { anime_data, genres, year, studio, season, episodes } from "../data";
import { FilterSearch } from "../components/Anime/FilterSearch";
import { BrowseAnime } from "../components/Anime/BrowseAnime";


const Anime = () => {
return (
<>
<div className="main3">
<div className="filter1 grid grid-cols-6 p-6 ">
<div className="flex flex-col justify-start ml-3 mt-3">
<p className="filter_txt1">Search:</p>

<div className="search-container">
<div className="input-container1">
<input type="text" placeholder="Search" />
<button className="search-icon">
<i className="bx bx-search-alt-2"></i>
</button>
</div>
</div>
</div>

<div className="flex flex-col justify-start ml-3 mt-3">
<p className="filter_txt1">Genres:</p>

<select className="dropdown-select_g1" multiple>
{/* all genres possible */}

{genres.map((item, index) => (
<option value={item} key={index}>
{item}
</option>
))}
</select>
</div>

<div className="flex flex-col justify-start ml-3 mt-3">
<p className="filter_txt1">Year:</p>

<select className="dropdown-select1">
<option disabled selected>
Year
</option>
{/* years from 1940 to 2023 */}

{year.map((item, index) => (
<option value={item} key={index}>
{item}
</option>
))}
</select>
</div>

<div className="flex flex-col justify-start ml-3 mt-3">
<p className="filter_txt1">Studio:</p>

<select className="dropdown-select1">
<option selected disabled>
Studio
</option>

{/* choose studios */}

{studio.map((item, index) => (
<option value={item} key={index}>
{item}
</option>
))}
</select>
</div>

<div className="flex flex-col justify-start ml-3 mt-3">
<p className="filter_txt1">Seasons:</p>

<select className="dropdown-select1">
<option selected disabled>
Seasons
</option>

{/* choose studios */}

{season.map((item, index) => (
<option value={item} key={index}>
{item}
</option>
))}
</select>
</div>

<div className="flex flex-col justify-start ml-3 mt-3">
<p className="filter_txt1">Episodes:</p>

<select className="dropdown-select1">
<option selected disabled>
Episodes
</option>

{/* choose studios */}

{episodes.map((item, index) => (
<option value={item} key={index}>
{item}
</option>
))}
</select>
</div>
</div>

<div className=" cards_container1 grid grid-cols-6 gap-x-6 gap-y-6 p-6 ">
{anime_data.map((item) => (
<Link
to="/detailspage"
state={{ id: item.anime_id, anime: true }}
key={item.anime_id}
>
<div className="card">
<div className="card_img1">
<img src={item.image} />
</div>

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

<p className="title8">{item.title}</p>
<FilterSearch />

{/*TODO you add favorite button, and for it to work properly */}
</div>
</div>
</Link>
))}
</div>
{/* TODO cards. try to extract ONE for all 3. anime, manga, and explore ! and all to use same .css scoped file if possible ! because this one you copy/pasted ! and just need little tweak here and there, and this can be smaller and more compact. so easier for responsive design later... */}
<BrowseAnime />
</div>
</>
);
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/styles/BrowseHome.scoped.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,15 @@
.submit {
width: 90%;
color: white;
background-color: #ea1179;
}

.submit:hover{
background-color: #b80c5f
}



/* button for search */

.search-container {
Expand Down

0 comments on commit c660661

Please sign in to comment.