From 21b3b5d9831019f2c2962043ce29a01d09a47294 Mon Sep 17 00:00:00 2001 From: Mario Souto <13791385+omariosouto@users.noreply.github.com> Date: Sat, 24 Feb 2024 12:30:29 -0300 Subject: [PATCH] feat: add language menu and 7days of code CTA --- src/components/Link/index.tsx | 2 + src/patterns/Menu/index.tsx | 2 +- src/patterns/ScreenHeroContainer/index.tsx | 6 +- .../LanguageSwitch/LanguageSwitch.tsx | 200 ++++++++++++++++++ 4 files changed, 205 insertions(+), 5 deletions(-) create mode 100644 src/patterns/ScreenHeroContainer/patterns/LanguageSwitch/LanguageSwitch.tsx diff --git a/src/components/Link/index.tsx b/src/components/Link/index.tsx index ac073410f..4620a104a 100644 --- a/src/components/Link/index.tsx +++ b/src/components/Link/index.tsx @@ -17,6 +17,8 @@ function withLocalePrefix( locale: string, isExternalURL: boolean ) { + const isAnchor = href?.startsWith("#"); + if (isAnchor) return href; if (isExternalURL) return href; const urlLocale = urlLocaleBySiteLocale[locale]; diff --git a/src/patterns/Menu/index.tsx b/src/patterns/Menu/index.tsx index 8fea2d717..7e18cc88d 100644 --- a/src/patterns/Menu/index.tsx +++ b/src/patterns/Menu/index.tsx @@ -39,7 +39,7 @@ export default function Menu() { src="https://ghbtns.com/github-btn.html?user=alura&repo=techguide&type=star&count=true" frameBorder="0" scrolling="0" - width="110" + width="101" height="30" title="GitHub" /> diff --git a/src/patterns/ScreenHeroContainer/index.tsx b/src/patterns/ScreenHeroContainer/index.tsx index 945a64c27..1f99d4304 100644 --- a/src/patterns/ScreenHeroContainer/index.tsx +++ b/src/patterns/ScreenHeroContainer/index.tsx @@ -7,6 +7,7 @@ import SecondContentSection from "./patterns/SecondContentSection"; import FAQContentSection from "./patterns/FAQContentSection"; import HeroTitle from "./patterns/HeroTitle"; import { PathScreenGetGuideBySlugQuery } from "@src/gql_types"; +import { LanguageSwitch } from "./patterns/LanguageSwitch/LanguageSwitch"; interface ScreenHeroContainerProps { guide?: PathScreenGetGuideBySlugQuery["guide"]; @@ -28,6 +29,7 @@ export default function ScreenHeroContainer({ overflow: "hidden", }} > + diff --git a/src/patterns/ScreenHeroContainer/patterns/LanguageSwitch/LanguageSwitch.tsx b/src/patterns/ScreenHeroContainer/patterns/LanguageSwitch/LanguageSwitch.tsx new file mode 100644 index 000000000..c5048f173 --- /dev/null +++ b/src/patterns/ScreenHeroContainer/patterns/LanguageSwitch/LanguageSwitch.tsx @@ -0,0 +1,200 @@ +import React from "react"; +import { Box, Link } from "@src/components"; + +const languages = [ + { + label: "PT", + link: "https://techguide.sh/", + flag: ( + + + + + + + + + + + + ), + }, + { + label: "EN", + link: "https://techguide.sh/en-US", + flag: ( + + + + + + + ), + }, + { + label: "ES", + link: "https://techguide.sh/es", + flag: ( + + + + + + + + + + + + ), + }, +]; + +export function LanguageSwitch() { + return ( + + + + Pratique Agora! + + + {languages.map(({ label, flag, link }) => { + return ( + + + {flag} + + {label} + + ); + })} + + + + ); +}