Skip to content

Commit

Permalink
feat: 🎸 special orchid component
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoang-Nguyen-Huy committed Oct 2, 2024
1 parent 1bbf2f5 commit d166659
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Footer from "./components/Footer/Footer";
import Content from "./components/MainContent/Content";
import { Route, Routes } from "react-router-dom";
import OrchidDetail from "./components/OrchidDetail";
import SpecialOrchid from "./components/SpecialOrchid";

function App() {
const [count, setCount] = useState(0);
Expand All @@ -14,6 +15,7 @@ function App() {
<Header />
<Routes>
<Route path='/fer-lab1/' element={<Content />} />
<Route path='/fer-lab1/natural' element={<SpecialOrchid />} />
<Route path='/fer-lab1/:id' element={<OrchidDetail />}></Route>
</Routes>
<Footer />
Expand Down
4 changes: 4 additions & 0 deletions src/components/Header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const pages = [
name: "Home",
path: "/fer-lab1/",
},
{
name: "Special",
path: "/fer-lab1/natural",
},
{
name: "About",
path: "/fer-lab1/about",
Expand Down
4 changes: 2 additions & 2 deletions src/components/MainContent/Content.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Container, Grid } from "@mui/joy";
import { Grid } from "@mui/joy";
import React from "react";
import { Orchids } from "../../ListOfOrchids";
import OrchidCard from "./OrchidCard";
Expand All @@ -19,7 +19,7 @@ export default function Content() {
padding: 2,
width: "100%",
margin: "0 auto",
backgroundColor: theme.mainContent.backgroundColor
backgroundColor: theme.mainContent.backgroundColor,
}}
>
{Orchids.map((orchid) => {
Expand Down
36 changes: 36 additions & 0 deletions src/components/SpecialOrchid.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Grid } from "@mui/joy";
import React from "react";
import { Orchids } from "../ListOfOrchids";
import OrchidCard from "./MainContent/OrchidCard";
import { useContext } from "react";
import { ThemeContext } from "../themes/ThemeContext";

export default function SpecialOrchid() {
const { theme } = useContext(ThemeContext);

//Filter orchids to only include special ones
const specialOrchids = Orchids.filter((orchid) => orchid.isSpecial);
return (
<Grid
container
spacing={{ xs: 2, md: 3, lg: 4 }}
// columns={{ xs: 1, sm: 2, md: 3, lg: 4 }}
sx={{
flexGrow: 1,
justifyContent: "center",
padding: 2,
width: "100%",
margin: "0 auto",
backgroundColor: theme.mainContent.backgroundColor,
}}
>
{specialOrchids.map((orchid) => {
return (
<Grid key={orchid.Id} size={{ xs: 1, sm: 3, md: 4 }}>
<OrchidCard key={orchid.Id} orchid={orchid} />
</Grid>
);
})}
</Grid>
);
}

0 comments on commit d166659

Please sign in to comment.