Skip to content

Commit

Permalink
Merge pull request #4 from vgeruso/develop
Browse files Browse the repository at this point in the history
[ADD] experinece years on text presentation
  • Loading branch information
vgeruso authored Sep 10, 2024
2 parents 1edb073 + f58447f commit 95a54d0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/components/CardInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const tools: any = [
];

const CardInfo: FC = () => {
const { old } = useYear();
const { old , experienceYears} = useYear();

return (
<ContainerDark>
Expand All @@ -104,7 +104,7 @@ const CardInfo: FC = () => {
estruturas e armazenamento de dados.
</Pargraph>
<Pargraph>
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,
Expand Down
13 changes: 11 additions & 2 deletions src/hooks/useYear.tsx
Original file line number Diff line number Diff line change
@@ -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<number>(0);
const [old, setOld] = useState<number>(0);
const [experienceYears, setEperienceYears] = useState<number>(0);

useEffect(() => {
const today = new Date();
Expand All @@ -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};
}
9 changes: 3 additions & 6 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<PageProps> = () => {
const IndexPage: FC<PageProps> = () => {
return (
<>
<GlobalStyle/>
Expand All @@ -31,11 +30,9 @@ const IndexPage: FC<PageProps> = () => {
export default IndexPage;

export const Head: HeadFC = () => {
const { year } = useYear();

return (
return (
<>
<title>Geruso | {year}</title>
<title>Geruso</title>
<link rel="icon" type="image/x-icon" href="../../icon.ico" />
</>
);
Expand Down

0 comments on commit 95a54d0

Please sign in to comment.