Skip to content

Commit

Permalink
Add flag select component
Browse files Browse the repository at this point in the history
  • Loading branch information
VojtaStruhar committed Jan 8, 2025
1 parent 495bf07 commit cfff995
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 9 deletions.
24 changes: 24 additions & 0 deletions src/components/FlagSelect.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
let lang = Astro.currentLocale;
let descriptions = [
{ code: "en", flag: "🇬🇧" },
{ code: "es", flag: "🇪🇸" },
];
---

<div class="flex gap-4 text-3xl mb-4">
{
descriptions.map((data) => (
<a
href={"/steam-review-template/" + data.code}
class:list={[
data.code == lang && "outline",
"rounded no-underline text-white",
"hover:bg-white hover:bg-opacity-20",
]}
>
{data.flag}
</a>
))
}
</div>
6 changes: 5 additions & 1 deletion src/layouts/PageLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ let config_json = templates[Astro.currentLocale] || templates.en;
<meta charset="UTF-8" />
<meta name="description" content="Astro description" />
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link
rel="icon"
type="image/svg+xml"
href={"/steam-review-template/favicon.svg"}
/>
<meta name="generator" content={Astro.generator} />
<title>{title}</title>
<script
Expand Down
6 changes: 2 additions & 4 deletions src/pages/en/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
import config_json from "../../review_templates/template_en.json";
import PageLayout from "../../layouts/PageLayout.astro";
import OptionForm from "../../components/OptionForm.astro";
import SpainFlag from "../../components/flags/SpainFlag.astro";
import FlagSelect from "../../components/FlagSelect.astro";
---

<PageLayout title="Steam Review Template">
<header class="bg-slate-700 text-white py-2 flex flex-col items-center">
<h1>{"---{ Review Template }---"}</h1>
<a href="/steam-review-template/es/" class="mt-0 text-white"
><SpainFlag class="w-4 h-4" /></a
>
<FlagSelect />
<p class="mt-0">☑ Awesome</p>
</header>

Expand Down
6 changes: 2 additions & 4 deletions src/pages/es/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
import config_json from "../../review_templates/template_es.json";
import PageLayout from "../../layouts/PageLayout.astro";
import OptionForm from "../../components/OptionForm.astro";
import UKFlag from "../../components/flags/UKFlag.astro";
import FlagSelect from "../../components/FlagSelect.astro";
---

<PageLayout title="Plantilla de reseñas de steam">
<header class="bg-slate-700 text-white py-2 flex flex-col items-center">
<h1>{"---{ Plantilla para reseñas }---"}</h1>
<a href="/steam-review-template/en/" class="mt-0 text-white"
><UKFlag class="w-4 h-4" /></a
>
<FlagSelect />
<p class="mt-0">☑ Asombroso</p>
</header>

Expand Down

0 comments on commit cfff995

Please sign in to comment.