@@ -103,6 +103,116 @@ const Filter = ({
);
};
+const FilterMobile = ({
+ setFilterMobile,
+ type,
+ topic,
+ year,
+ onSavedFilter,
+ selectedFilters,
+}: any) => {
+ const [filters, setFilters] = useState({
+ type: [...selectedFilters.type],
+ topic: [...selectedFilters.topic],
+ year: [...selectedFilters.year],
+ });
+
+ const toggleFilter = (
+ filterType: "type" | "topic" | "year",
+ value: string
+ ) => {
+ setFilters((prevFilters) => {
+ const currentValues = prevFilters[filterType];
+ const newValues = currentValues.includes(value)
+ ? currentValues.filter((v) => v !== value)
+ : [...currentValues, value];
+ return { ...prevFilters, [filterType]: newValues };
+ });
+ };
+
+ const handleSavedAndClosed = () => {
+ onSavedFilter(filters);
+ setFilterMobile(false);
+ };
+
+ return (
+
+
+
Filtros
+
+
+
+
+
Tipo de recurso
+
+ {type.map((item: string) => (
+
+ ))}
+
+
+
+
+
Assunto
+
+ {topic.map((item: string) => (
+
+ ))}
+
+
+
+
+
Ano de publicação
+
+ {year.map((item: string) => (
+
+ ))}
+
+
+
+
+
+
+
+ );
+};
+
const Card = ({ image, tag, title, link }: Card) => {
const openNewWindow = (link: string[] | undefined) => {
if (!link) return console.error("Vazio");
@@ -112,13 +222,13 @@ const Card = ({ image, tag, title, link }: Card) => {
return (
{title}
-
+
{tag?.map((item, i) => {
return item.key === "tag" ? (
@@ -157,6 +267,7 @@ const ResourceIsland = ({
cards.categories?.some((category) => category.slug === "guides")
);
const [filteredCardsSearch, setFilteredCardsSearch] = useState(cardsFiltered);
+ const [filterMobile, setFilterMobile] = useState(false);
const filterCards = (term: string) => {
const filtered = cardsFiltered?.filter((card) =>
@@ -198,6 +309,10 @@ const ResourceIsland = ({
});
};
+ const onSavedFilter = (filters: Filters) => {
+ setFilters(filters);
+ };
+
const filteredCards = filteredCardsSearch?.filter((card) => {
const matchesType = filters.type.length
? filters.type.some((filterType) =>
@@ -216,7 +331,7 @@ const ResourceIsland = ({
: true;
const matchesYear = filters.year.length
- ? filters.year.includes(card.date.slice(0, 4)) // Extrai o ano de "date"
+ ? filters.year.includes(card.date.slice(0, 4))
: true;
return matchesType && matchesTopic && matchesYear;
@@ -227,7 +342,7 @@ const ResourceIsland = ({
(card) => card?.extraProps?.find((item) => item.key === "link")?.value
)
.filter((value) => value !== undefined);
- console.log(extractLinkToDownload);
+
const itemsPerPage = 9;
const {
currentItems,
@@ -240,32 +355,54 @@ const ResourceIsland = ({
return (
+ {filterMobile && (
+
+ )}
{title}
{description}
-
-
diff --git a/static/tailwind.css b/static/tailwind.css
index 7213de6..c141922 100644
--- a/static/tailwind.css
+++ b/static/tailwind.css
@@ -2920,12 +2920,12 @@ html {
.min-w-\[157px\] {
min-width: 157px;
}
-.min-w-\[230px\] {
- min-width: 230px;
-}
.min-w-\[240px\] {
min-width: 240px;
}
+.min-w-\[300px\] {
+ min-width: 300px;
+}
.min-w-\[400px\] {
min-width: 400px;
}
@@ -3233,6 +3233,9 @@ html {
.overflow-x-auto {
overflow-x: auto;
}
+.overflow-y-auto {
+ overflow-y: auto;
+}
.overflow-x-hidden {
overflow-x: hidden;
}
@@ -4195,6 +4198,10 @@ html {
width: 100%;
}
+ .md\:min-w-\[230px\] {
+ min-width: 230px;
+ }
+
.md\:max-w-\[1354px\] {
max-width: 1354px;
}