From a00fc2c328283dae26ae7531efaabb77292c450c Mon Sep 17 00:00:00 2001 From: NedcloarBR Date: Sat, 25 Jan 2025 20:18:23 -0300 Subject: [PATCH] feat: add section component --- src/components/about.tsx | 47 ++++++++++++++++------ src/components/contact.tsx | 14 +++---- src/components/index.ts | 1 + src/components/section/index.ts | 9 +++++ src/components/section/section-content.tsx | 15 +++++++ src/components/section/section-root.tsx | 17 ++++++++ src/components/section/section-title.tsx | 15 +++++++ src/components/skills.tsx | 13 +++--- src/components/start.tsx | 7 ++-- 9 files changed, 108 insertions(+), 30 deletions(-) create mode 100644 src/components/section/index.ts create mode 100644 src/components/section/section-content.tsx create mode 100644 src/components/section/section-root.tsx create mode 100644 src/components/section/section-title.tsx diff --git a/src/components/about.tsx b/src/components/about.tsx index 868a594..96f2c22 100644 --- a/src/components/about.tsx +++ b/src/components/about.tsx @@ -6,7 +6,8 @@ import { useState, useRef, useEffect } from "react"; import { HeaderAnchor } from "./header/header-anchor"; import { motion } from "framer-motion"; import { Icon } from "./icon"; -import { Mail } from "lucide-react" +import { Mail } from "lucide-react"; +import { Section } from "./section"; export function About() { const t = useTranslations("About"); @@ -22,11 +23,9 @@ export function About() { }, []); return ( -
-

- {t("Title")} -

-
+ + +
- - document.getElementById("contact")?.scrollIntoView({ behavior: "smooth", block: "start" })}/> -
@@ -73,7 +94,7 @@ export function About() { {isExpanded ? t("Button2") : t("Button")}
- -
+ + ); } diff --git a/src/components/contact.tsx b/src/components/contact.tsx index 4d3b41b..07368f2 100644 --- a/src/components/contact.tsx +++ b/src/components/contact.tsx @@ -17,6 +17,8 @@ import { Input, Textarea, } from "@/components/ui"; +import { Section } from "./section"; + export function Contact() { const t = useTranslations("Contact"); @@ -53,11 +55,9 @@ export function Contact() { } return ( -
-

- {t("Title")} -

-
+ + +
Submit -
-
+ + ); } diff --git a/src/components/index.ts b/src/components/index.ts index 1f03c7f..05d156e 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -7,5 +7,6 @@ export * from "./header"; export * from "./icon"; export * from "./main-container"; export * from "./projects"; +export * from "./section"; export * from "./start"; export * from "./theme"; diff --git a/src/components/section/index.ts b/src/components/section/index.ts new file mode 100644 index 0000000..b72f8e7 --- /dev/null +++ b/src/components/section/index.ts @@ -0,0 +1,9 @@ +import { SectionContent } from "./section-content"; +import { SectionRoot } from "./section-root"; +import { SectionTitle } from "./section-title"; + +export const Section = { + Root: SectionRoot, + Title: SectionTitle, + Content: SectionContent, +}; diff --git a/src/components/section/section-content.tsx b/src/components/section/section-content.tsx new file mode 100644 index 0000000..d2ad1b0 --- /dev/null +++ b/src/components/section/section-content.tsx @@ -0,0 +1,15 @@ +import { cn } from "@/lib/utils"; +import type { ClassValue } from "clsx"; + +interface SectionContentProps { + children: React.ReactNode; + className?: ClassValue; +} + +export function SectionContent({ children, className }: Readonly) { + return ( +
+ {children} +
+ ); +} \ No newline at end of file diff --git a/src/components/section/section-root.tsx b/src/components/section/section-root.tsx new file mode 100644 index 0000000..b366149 --- /dev/null +++ b/src/components/section/section-root.tsx @@ -0,0 +1,17 @@ +import { cn } from "@/lib/utils"; +import type{ ClassValue } from "clsx"; + +interface SectionRootProps { + id: string; + children: React.ReactNode; + className?: ClassValue; + ref?: React.Ref; +} + +export function SectionRoot({ id, children, className, ref }: Readonly) { + return ( +
+ {children} +
+ ); +} \ No newline at end of file diff --git a/src/components/section/section-title.tsx b/src/components/section/section-title.tsx new file mode 100644 index 0000000..1282e55 --- /dev/null +++ b/src/components/section/section-title.tsx @@ -0,0 +1,15 @@ +import { cn } from "@/lib/utils"; +import type { ClassValue } from "clsx"; + +interface SectionTitleProps { + title: string; + className?: ClassValue; +} + +export function SectionTitle({ title, className }: Readonly) { + return ( +

+ {title} +

+ ); +} \ No newline at end of file diff --git a/src/components/skills.tsx b/src/components/skills.tsx index e2f5cb5..91647ae 100644 --- a/src/components/skills.tsx +++ b/src/components/skills.tsx @@ -17,6 +17,7 @@ import Link from "next/link"; import { SkillData } from "@/@types"; import { skills } from "@/constants"; import { track } from "@vercel/analytics"; +import { Section } from "./section"; export function Skills() { const t = useTranslations("Skills"); @@ -52,11 +53,9 @@ export function Skills() { } return ( -
-

- {t("Title")} -

-
+ + + {Array.from(skillsByCategory.entries()).map( ([category, categorySkills]) => ( ) )} -
+ {dialogSkill && ( setIsOpen(open)}> @@ -115,6 +114,6 @@ export function Skills() { )} -
+ ); } diff --git a/src/components/start.tsx b/src/components/start.tsx index 6bb41e2..321a865 100644 --- a/src/components/start.tsx +++ b/src/components/start.tsx @@ -3,22 +3,23 @@ import { useTranslations } from "next-intl"; import { useRef } from "react"; import { BackToTop } from "./back-to-top"; +import { Section } from "./section"; export function Start() { const t = useTranslations(); const startRef = useRef(null); return ( -

{t("WIP")}

{t("Start.Hello")}
{t("Start.Name")}
{t("Start.Details")}
-
+ ); }