From f58447fc57ce8a56684ca289206acdef3e2a7d4e Mon Sep 17 00:00:00 2001 From: Victor Geruso Date: Tue, 10 Sep 2024 15:32:24 -0300 Subject: [PATCH] [ADD] experinece years on text presentation --- src/components/CardInfo/index.tsx | 4 ++-- src/hooks/useYear.tsx | 13 +++++++++++-- src/pages/index.tsx | 9 +++------ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/components/CardInfo/index.tsx b/src/components/CardInfo/index.tsx index 18d609d..d009a0e 100644 --- a/src/components/CardInfo/index.tsx +++ b/src/components/CardInfo/index.tsx @@ -81,7 +81,7 @@ const tools: any = [ ]; const CardInfo: FC = () => { - const { old } = useYear(); + const { old , experienceYears} = useYear(); return ( @@ -104,7 +104,7 @@ const CardInfo: FC = () => { estruturas e armazenamento de dados. - Possuo experiencia de 4.6 anos em desenvolvimento Web, trabalhando a + Possuo experiencia de {experienceYears} anos em desenvolvimento Web, trabalhando a maior parte do tempo como fullstack em empresas conceituadas na área da região metropolitana de Salvador, nessas empresas atuei com documentação e desenvolvimento de sites, serviços web/mobile, APIs, diff --git a/src/hooks/useYear.tsx b/src/hooks/useYear.tsx index da500e2..452501b 100644 --- a/src/hooks/useYear.tsx +++ b/src/hooks/useYear.tsx @@ -1,8 +1,15 @@ import { useEffect, useState } from "react" -export const useYear = (): {year: number, old: number} => { +type NumbersPresentation = { + year: number, + old: number, + experienceYears: number, +}; + +export const useYear = (): NumbersPresentation => { const [year, setYear] = useState(0); const [old, setOld] = useState(0); + const [experienceYears, setEperienceYears] = useState(0); useEffect(() => { const today = new Date(); @@ -11,13 +18,15 @@ export const useYear = (): {year: number, old: number} => { const actualMonth = today.getMonth()+1; const preOld = (year-1996); + const experience = (year-2019); setOld(preOld); + setEperienceYears(experience); if (actualMonth < 5) setOld(preOld-1); }, [year, old]) - return {year, old}; + return {year, old, experienceYears}; } \ No newline at end of file diff --git a/src/pages/index.tsx b/src/pages/index.tsx index bfb3d57..bbc26c5 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -9,9 +9,8 @@ import { MainContainer } from "../styles/HomeStyles"; import CardInfo from "../components/CardInfo"; import CardPosts from "../components/CardPosts"; import CardContributions from "../components/CardContributions"; -import { useYear } from "../hooks/useYear"; -const IndexPage: FC = () => { +const IndexPage: FC = () => { return ( <> @@ -31,11 +30,9 @@ const IndexPage: FC = () => { export default IndexPage; export const Head: HeadFC = () => { - const { year } = useYear(); - - return ( + return ( <> - Geruso | {year} + Geruso );