refactor: separate strings

This commit is contained in:
GivFNZ 2025-02-21 19:25:21 -03:00
parent 7a14a8cb77
commit db00ee6b29
No known key found for this signature in database
GPG Key ID: 63DD92181B575322
9 changed files with 53 additions and 16 deletions

View File

@ -1,8 +1,14 @@
import { HashRouter } from "react-router-dom"; import { HashRouter } from "react-router-dom";
import { HeaderContainer, NavLink, HomeLink } from "./styles"; import { HeaderContainer, NavLink, HomeLink, LanguageSelector } from "./styles";
import { AvatarHeader } from "../Avatar/avatar"; import { AvatarHeader } from "../Avatar/avatar";
import i18n from "../../utils/i18n";
import { t } from "i18next";
export default function Header() { export default function Header() {
const changeLanguage = (event: React.ChangeEvent<HTMLSelectElement>) => {
i18n.changeLanguage(event.target.value);
localStorage.setItem("language", event.target.value); // Salva escolha do usuário
};
return ( return (
<HashRouter> <HashRouter>
<HeaderContainer> <HeaderContainer>
@ -11,9 +17,17 @@ export default function Header() {
Giv's Website Giv's Website
</HomeLink> </HomeLink>
<nav> <nav>
<NavLink href="#about">About Me</NavLink> <NavLink href="#about">{t("about")}</NavLink>
<NavLink href="#contact">Contact</NavLink> <NavLink href="#contact">{t("contact")}</NavLink>
<NavLink href="#projects">Projects</NavLink> <NavLink href="#projects">{t("projects")}</NavLink>
<LanguageSelector onChange={changeLanguage}>
<option value="pt-br">
Português
</option>
<option value="en-us">
English
</option>
</LanguageSelector>
</nav> </nav>
</HeaderContainer> </HeaderContainer>
</HashRouter> </HashRouter>

View File

@ -44,3 +44,13 @@ export const HeaderContainer = styled.div`
gap: 1rem; gap: 1rem;
} }
`; `;
export const LanguageSelector = styled.select`
background-color: ${props => props.theme["gray-800"]};
color: ${props => props.theme.white};
border-radius: 8px;
padding: 5px;
border: 0;
align-items: center;
justify-content: center;
`

View File

@ -1,3 +1,11 @@
{ {
"about": "I'm Giovani, a software engineering student, interning and studying in Minas Gerais, Brazil!" "about": "About me",
"aboutText": "I'm Giovani, a software engineering student, interning and studying in Minas Gerais, Brazil!",
"contact": "Contact",
"contactInfo": "If you want to contact me, you can use the links above, or say put in the field below to send me an email!",
"checkSocialLinks": "Hey, check out my social links!",
"welcome": "Hi, I'm Giovani! Welcome to my website!",
"skills": "Skills",
"projects": "Projects",
"send": "Send"
} }

View File

@ -1,3 +1,4 @@
{ {
"about": "Meu nome é Giovani, estudante de engenharia de software, estagiando e estudando em Minas Gerais, Brasil!" "about": "Sobre mim",
"aboutText": "Meu nome é Giovani, estudante de engenharia de software, estagiando e estudando em Minas Gerais, Brasil!"
} }

View File

@ -7,9 +7,9 @@ export default function About() {
const { t } = useTranslation(); const { t } = useTranslation();
return ( return (
<MainContainer> <MainContainer>
<h1>About Me</h1> <h1>{t("about")}</h1>
<Paragraph> <Paragraph>
<span>{t("about")}</span> <span>{t("aboutText")}</span>
</Paragraph> </Paragraph>
</MainContainer> </MainContainer>
); );

View File

@ -3,6 +3,7 @@ import { Button, TextArea } from './styles';
import { MainContainer } from '../../components/MainContent/styles'; import { MainContainer } from '../../components/MainContent/styles';
import { Send } from 'lucide-react'; import { Send } from 'lucide-react';
import { Paragraph } from '../../components/Paragraph/styles'; import { Paragraph } from '../../components/Paragraph/styles';
import { t } from 'i18next';
export default function Contact() { export default function Contact() {
const emailAddress = import.meta.env.VITE_GIV_EMAIL; const emailAddress = import.meta.env.VITE_GIV_EMAIL;
@ -15,16 +16,16 @@ export default function Contact() {
return ( return (
<MainContainer> <MainContainer>
<h1>Contact</h1> <h1>{t("contact")}</h1>
<Paragraph> <Paragraph>
<span>If you want to contact me, you can use the links above, or say put in the field below to send me an email!</span> <span>{t("contactInfo")}</span>
</Paragraph> </Paragraph>
<form onSubmit={handleSubmit}> <form onSubmit={handleSubmit}>
<TextArea <TextArea
onChange={(e) => setTypedText(e.target.value)} onChange={(e) => setTypedText(e.target.value)}
className="bgb" className="bgb"
/> />
<Button type='submit'><Send className="ico" />Send</Button> <Button type='submit'><Send className="ico" />{t("send")}</Button>
</form> </form>
</MainContainer> </MainContainer>
); );

View File

@ -5,13 +5,14 @@ import { faTelegram, faGithub } from '@fortawesome/free-brands-svg-icons';
import { IconContainer, IconLink, HomeLabel, TopSection } from './styles'; import { IconContainer, IconLink, HomeLabel, TopSection } from './styles';
import { MainContainer } from '../../components/MainContent/styles'; import { MainContainer } from '../../components/MainContent/styles';
import { Avatar } from '../../components/Avatar/avatar'; import { Avatar } from '../../components/Avatar/avatar';
import { t } from 'i18next';
export default function Home() { export default function Home() {
const typedElement = useRef(null); const typedElement = useRef(null);
useEffect(() => { useEffect(() => {
const typed = new Typed(typedElement.current, { const typed = new Typed(typedElement.current, {
strings: ["Hi, I'm Giovani! Welcome to my website!"], strings: [t("welcome")],
typeSpeed: 70, typeSpeed: 70,
backSpeed: 50, backSpeed: 50,
loop: false, loop: false,
@ -31,7 +32,7 @@ export default function Home() {
</strong> </strong>
</TopSection> </TopSection>
<HomeLabel> <HomeLabel>
Hey, check out my social links! {t("checkSocialLinks")}
</HomeLabel> </HomeLabel>
<IconContainer> <IconContainer>
<IconLink href="https://t.me/@givfnz2" target="_blank" rel="noopener noreferrer"> <IconLink href="https://t.me/@givfnz2" target="_blank" rel="noopener noreferrer">

View File

@ -10,6 +10,7 @@ import {
ProjectStars, ProjectStars,
} from './styles'; } from './styles';
import { MainContainer } from '../../components/MainContent/styles'; import { MainContainer } from '../../components/MainContent/styles';
import { t } from 'i18next';
interface Repo { interface Repo {
name: string; name: string;
@ -34,7 +35,7 @@ export default function Projects() {
return ( return (
<MainContainer> <MainContainer>
<Title>Projects</Title> <Title>{t("projects")}</Title>
<ProjectGrid> <ProjectGrid>
{projects.map((project) => ( {projects.map((project) => (
<ProjectCard key={project.name} href={project.url} target="_blank" rel="noopener noreferrer"> <ProjectCard key={project.name} href={project.url} target="_blank" rel="noopener noreferrer">

View File

@ -2,11 +2,12 @@ import { MainContainer } from "../../components/MainContent/styles";
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faAndroid, faAngular, faGit, faLinux, faNode, faReact, faWindows } from '@fortawesome/free-brands-svg-icons' import { faAndroid, faAngular, faGit, faLinux, faNode, faReact, faWindows } from '@fortawesome/free-brands-svg-icons'
import { SkillsContainer } from "./styles"; import { SkillsContainer } from "./styles";
import { t } from "i18next";
export default function Skills() { export default function Skills() {
return ( return (
<MainContainer> <MainContainer>
<h1>Skills</h1> <h1>{t("skills")}</h1>
<SkillsContainer> <SkillsContainer>
<FontAwesomeIcon size="2x" style={{ color: '#fff' }} icon={faAndroid} /> <FontAwesomeIcon size="2x" style={{ color: '#fff' }} icon={faAndroid} />
<p>Android</p> <p>Android</p>