Summary (required)

This commit is contained in:
Blboun3 2024-03-26 21:12:10 +01:00
parent fbd130eb8b
commit 44eabc1a09
No known key found for this signature in database
7 changed files with 69 additions and 10 deletions

View File

@ -0,0 +1,23 @@
---
import Navlink from "./Navlink.astro";
const links = [
{
display: "Home",
icon: "H",
href: "/"
},{
display: "Blog",
icon: "B",
href: "/blog"
}, {
display: "About",
icon: "A",
href: "/about"
}
];
---
<nav class="bg-white w-full flex justify-center">
<div class="justify-around w-full md:w-[767px] flex">
{ links.map((item) => (<Navlink href={item.href}, display={item.display}, icon={item.icon} isActive={ (Astro.url.pathname.replace(Astro.currentLocale + "/", "").slice(0,-1) || "/") == item.href}/>)) }
</div>
</nav>

View File

@ -0,0 +1,6 @@
---
import { getRelativeLocaleUrl } from "astro:i18n";
const { display, href, icon, isActive } = Astro.props;
---
<a href={getRelativeLocaleUrl(Astro.currentLocale, href)} class={(isActive ? "bg-yellow-300 " : " ") + "w-full text-center"}><span class="hidden lg:visible">{icon}</span><span>{display}</span></a>

View File

@ -1,2 +0,0 @@
export const SITE_TITLE = 'Astro Blog';
export const SITE_DESCRIPTION = 'Welcome to my website!';

View File

@ -1,5 +1,7 @@
--- ---
const { title, description, lang } = Astro.props; const { title, description, lang } = Astro.props;
import Navbar from "../components/Navbar.astro";
import "../style/index.css";
--- ---
<!DOCTYPE html> <!DOCTYPE html>
<html lang={lang}> <html lang={lang}>
@ -9,7 +11,8 @@ const { title, description, lang } = Astro.props;
<meta name="description" content={description}> <meta name="description" content={description}>
<title>{title}</title> <title>{title}</title>
</head> </head>
<body> <body class="bg-bkg">
<Navbar />
<slot/> <slot/>
</body> </body>
</html> </html>

View File

@ -0,0 +1,16 @@
---
import MainLayout from "../../../layouts/MainLayout.astro";
//@ts-ignore
import { dictionary } from "../../../i18n/dictionary";
const { title, description } = dictionary[Astro.currentLocale];
export async function getStaticPaths() {
return ["en", "fr", "cs", "de"].map((lang) => {
return { params: { lang } };
});
}
---
<MainLayout title={title} description={description} lang={Astro.currentLocale}>
</MainLayout>

View File

@ -0,0 +1,16 @@
---
import MainLayout from "../../../layouts/MainLayout.astro";
//@ts-ignore
import { dictionary } from "../../../i18n/dictionary";
const { title, description } = dictionary[Astro.currentLocale];
export async function getStaticPaths() {
return ["en", "fr", "cs", "de"].map((lang) => {
return { params: { lang } };
});
}
---
<MainLayout title={title} description={description} lang={Astro.currentLocale}>
</MainLayout>

View File

@ -1,8 +1,9 @@
--- ---
import { getLocaleByPath } from "astro:i18n";
import MainLayout from "../../layouts/MainLayout.astro"; import MainLayout from "../../layouts/MainLayout.astro";
//@ts-ignore
import { dictionary } from "../../i18n/dictionary"; import { dictionary } from "../../i18n/dictionary";
const { title } = dictionary[Astro.currentLocale]; const { title, description } = dictionary[Astro.currentLocale];
export async function getStaticPaths() { export async function getStaticPaths() {
return ["en", "fr", "cs", "de"].map((lang) => { return ["en", "fr", "cs", "de"].map((lang) => {
@ -10,10 +11,6 @@ export async function getStaticPaths() {
}); });
} }
--- ---
<MainLayout title={title} description={description} lang={Astro.currentLocale}>
<MainLayout title={title} description="sitedescription" lang={Astro.currentLocale}>
<h1>Welcome</h1>
<p>
{Astro.url.toString()}
</p>
</MainLayout> </MainLayout>