-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e0c972a
commit 033bd9a
Showing
4 changed files
with
98 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from "react"; | ||
|
||
function Nav(props) { | ||
return ( | ||
<div style={{ margin: "10px" }}> | ||
|
||
|
||
<button onClick={() => props.setFilter("UPM (REG)")}>dog</button> | ||
<button onClick={() => props.setFilter("UPM individual")}>cat</button> | ||
<button onClick={() => props.setFilter("other REG projects")}>lizard</button> | ||
</div> | ||
); | ||
} | ||
|
||
export default Nav; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React, { useState } from "react"; | ||
import Link from "next/link"; | ||
import { myProjectCards } from "@/constants/projectsCards"; | ||
|
||
export default function projectCards(props) { | ||
const [projectCards, setProjectCards] = useState(myProjectCards); | ||
const [selectedCategory, setSelectedCategory] = useState("all"); | ||
|
||
const handleCategoryChange = (category) => { | ||
setSelectedCategory(category); | ||
if (category === "all") { | ||
setProjectCards(myProjectCards); | ||
} else { | ||
const filteredCards = myProjectCards.filter( | ||
(card) => card.category === category | ||
); | ||
setProjectCards(filteredCards); | ||
} | ||
}; | ||
return ( | ||
<div className="project_cards"> | ||
<div className="filter_options"> | ||
<button onClick={() => handleCategoryChange("all")}>All</button> | ||
<button onClick={() => handleCategoryChange("ind")}>Ind</button> | ||
<button onClick={() => handleCategoryChange("REG")}>REG</button> | ||
<button onClick={() => handleCategoryChange("other")}>Other</button> | ||
</div> | ||
{projectCards.map( | ||
({ date, route, title, subtitle, tags, category }, index) => ( | ||
<div key={index} className="project_card"> | ||
<div className="year_and_cta"> | ||
<div className="date">{date}</div> | ||
<a href={route}>details</a> | ||
</div> | ||
<div className="project_info"> | ||
<div className="project_title">{title}</div> | ||
<div className="project_subtitle">{subtitle}</div> | ||
</div> | ||
<div className="project_tags">{tags}</div> | ||
</div> | ||
) | ||
)} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
export const myProjectCards = [ | ||
{ "date": "2023", | ||
"route": "https://innovacioneducativa.upm.es/mooc/informacion-mooc?idmooc=356", | ||
"title": "Utilización de escape rooms y videojuegos educativos en la Educación Universitaria", | ||
"subtitle": "E.T.S DE ING. DE SISTEMAS INFORMÁTICOS", | ||
"tags": "tag", | ||
"category": "REG", | ||
}, | ||
{ "date": "2023", | ||
"route": "https://innovacioneducativa.upm.es/mooc/informacion-mooc?idmooc=356", | ||
"title": "Utilización de escape rooms y videojuegos educativos en la Educación Universitaria", | ||
"subtitle": "E.T.S DE ING. DE SISTEMAS INFORMÁTICOS", | ||
"tags": "tag", | ||
"category": "ind", | ||
}, | ||
{ "date": "2023", | ||
"route": "https://innovacioneducativa.upm.es/mooc/informacion-mooc?idmooc=356", | ||
"title": "Utilización de escape rooms y videojuegos educativos en la Educación Universitaria", | ||
"subtitle": "E.T.S DE ING. DE SISTEMAS INFORMÁTICOS", | ||
"category": "other", | ||
}, | ||
{ "date": "2023", | ||
"route": "https://innovacioneducativa.upm.es/mooc/informacion-mooc?idmooc=356", | ||
"title": "Utilización de escape rooms y videojuegos educativos en la Educación Universitaria", | ||
"subtitle": "E.T.S DE ING. DE SISTEMAS INFORMÁTICOS", | ||
"tags": "tag", | ||
"category": "ind", | ||
} | ||
|
||
] |