Skip to content

Commit 3f057fe

Browse files
authored
Merge pull request #58 from OCA-UFCG/chore/theme-cards
Update the design for the "Explore nossos dados" section
2 parents ca0e300 + 4ea638f commit 3f057fe

12 files changed

Lines changed: 145 additions & 305 deletions

File tree

public/sprite.svg

Lines changed: 27 additions & 0 deletions
Loading

src/app/globals.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
@custom-variant dark (&:is(.dark *));
44

55
@theme {
6+
/* Palette */
67
--color-green-neutro: #D6E9DB;
78
--color-green-100: #EEFFF3;
89
--color-green-200: #D6FFE6;

src/app/page.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { SectionHeader } from "@/utils/interfaces";
55
import { AboutSection } from "@/components/About/About";
66
import { RecentSection } from "@/components/RecentSection/RecentSection";
77
import PreviewSection from "@/components/PreviewSection/PreviewSection";
8-
import PanelSection from "@/components/PanelCard/Section/PanelSection";
98
import BannerImage from "@/components/BannerImage/BannerImage";
9+
import DataSection from "@/components/DataSection/DataSection";
1010

1111
export const revalidate = 60;
1212

@@ -17,13 +17,14 @@ export default async function Home() {
1717
sectionHead,
1818
post: posts,
1919
previewCards,
20-
panels,
20+
theme,
2121
} = await getContent([
2222
"partners",
2323
"sectionHead",
2424
"post",
2525
"previewCards",
2626
"panels",
27+
"theme",
2728
]);
2829

2930
return (
@@ -42,12 +43,13 @@ export default async function Home() {
4243
section.fields.id === "about",
4344
)}
4445
/>
45-
<PanelSection
46+
<DataSection
4647
header={sectionHead.find(
4748
(sec: { fields: SectionHeader }) => sec.fields.id == "panels",
4849
)}
49-
panels={panels}
50+
categories={theme}
5051
/>
52+
5153
<ProjectSection
5254
header={sectionHead.find(
5355
(sec: { fields: SectionHeader }) => sec.fields.id == "projects",
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { MacroTheme } from "@/utils/interfaces";
2+
import { Icon } from "@/components/Icon/Icon";
3+
import { macroThemes } from "@/utils/constants";
4+
import Link from "next/link";
5+
6+
const CategoryCard = ({ category }: { category: { fields: MacroTheme } }) => {
7+
return (
8+
<Link
9+
href={`/posts?category=${category.fields.id}`}
10+
className="flex justify-between items-center rounded-sm shadow-sm p-4 w-full bg-grey-100 hover:bg-grey-200 border border-grey-200 hover:border-grey-300 cursor-pointer transition duration-300"
11+
key={category.fields.id}
12+
>
13+
<div className="flex flex-col md:flex-row w-full md:w-fit items-center justify-center gap-4">
14+
<div
15+
className="flex items-center justify-center rounded-sm min-w-[40px] w-[40px] h-[40px]"
16+
style={{ backgroundColor: category.fields.color }}
17+
>
18+
<Icon
19+
className="text-white"
20+
id={macroThemes[category.fields.id]}
21+
size={20}
22+
/>
23+
</div>
24+
<span className="text-base text-center md:text-start font-semibold md:max-w-[90%]">
25+
{category.fields.name}
26+
</span>
27+
</div>
28+
<Icon className="hidden md:flex rotate-270" id="expand" size={9} />
29+
</Link>
30+
);
31+
};
32+
33+
export default CategoryCard;
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import { MacroTheme, SectionHeader } from "@/utils/interfaces";
2+
import { Icon } from "@/components/Icon/Icon";
3+
import { LinkButton } from "@/components/LinkButton/LinkButton";
4+
import CategoryCard from "../CategoryCard/CategoryCard";
5+
6+
const DataSection = ({
7+
header,
8+
categories,
9+
}: {
10+
header?: { fields: SectionHeader };
11+
categories?: { fields: MacroTheme }[];
12+
}) => {
13+
const { title, subtitle } = header?.fields || {
14+
title: "",
15+
subtitle: "",
16+
};
17+
18+
const filteredData = categories?.sort((a, b) => {
19+
if (a.fields.id < b.fields.id) {
20+
return -1;
21+
}
22+
if (a.fields.id > b.fields.id) {
23+
return 1;
24+
}
25+
26+
return 0;
27+
});
28+
29+
return (
30+
<section
31+
className="w-full max-w-[1440px] px-4 py-6 content-center flex flex-col gap-6 box-border"
32+
id={title}
33+
>
34+
<div className="flex flex-col gap-3">
35+
<div className="flex justify-between w-full">
36+
<h2 className="text-3xl font-semibold">{title}</h2>
37+
<LinkButton
38+
href="/posts"
39+
variant="secondary"
40+
className="w-fit hidden md:flex"
41+
>
42+
<p>Ver Todos</p>
43+
<Icon className="rotate-270 size-2" id="expand" />
44+
</LinkButton>
45+
</div>
46+
<p className="text-sm">{subtitle}</p>
47+
</div>
48+
<div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6">
49+
{filteredData?.map((category: { fields: MacroTheme }) => (
50+
<CategoryCard key={category.fields.id} category={category} />
51+
))}
52+
</div>
53+
<LinkButton href="/posts" variant="secondary" className="md:hidden">
54+
<p>Ver Todos</p>
55+
<Icon className="rotate-270 size-2" id="expand" />
56+
</LinkButton>
57+
</section>
58+
);
59+
};
60+
61+
export default DataSection;

src/components/PanelCard/PanelCard.styles.tsx

Lines changed: 0 additions & 100 deletions
This file was deleted.

src/components/PanelCard/PanelCard.tsx

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)