diff --git a/strapi/src/api/global/content-types/global/schema.json b/strapi/src/api/global/content-types/global/schema.json new file mode 100644 index 0000000..3495c5f --- /dev/null +++ b/strapi/src/api/global/content-types/global/schema.json @@ -0,0 +1,20 @@ +{ + "kind": "singleType", + "collectionName": "globals", + "info": { + "singularName": "global", + "pluralName": "globals", + "displayName": "Global" + }, + "options": { + "draftAndPublish": true + }, + "pluginOptions": {}, + "attributes": { + "Navbar": { + "type": "component", + "repeatable": false, + "component": "global.navbar" + } + } +} diff --git a/strapi/src/api/global/controllers/global.ts b/strapi/src/api/global/controllers/global.ts new file mode 100644 index 0000000..9657646 --- /dev/null +++ b/strapi/src/api/global/controllers/global.ts @@ -0,0 +1,7 @@ +/** + * global controller + */ + +import { factories } from "@strapi/strapi"; + +export default factories.createCoreController("api::global.global"); diff --git a/strapi/src/api/global/routes/global.ts b/strapi/src/api/global/routes/global.ts new file mode 100644 index 0000000..169d3e6 --- /dev/null +++ b/strapi/src/api/global/routes/global.ts @@ -0,0 +1,7 @@ +/** + * global router + */ + +import { factories } from "@strapi/strapi"; + +export default factories.createCoreRouter("api::global.global"); diff --git a/strapi/src/api/global/services/global.ts b/strapi/src/api/global/services/global.ts new file mode 100644 index 0000000..f791a1e --- /dev/null +++ b/strapi/src/api/global/services/global.ts @@ -0,0 +1,7 @@ +/** + * global service + */ + +import { factories } from "@strapi/strapi"; + +export default factories.createCoreService("api::global.global"); diff --git a/strapi/src/components/global/navbar.json b/strapi/src/components/global/navbar.json new file mode 100644 index 0000000..5492f7f --- /dev/null +++ b/strapi/src/components/global/navbar.json @@ -0,0 +1,21 @@ +{ + "collectionName": "components_global_navbars", + "info": { + "displayName": "navbar", + "description": "" + }, + "options": {}, + "attributes": { + "logo": { + "type": "media", + "multiple": false, + "required": false, + "allowedTypes": ["images"] + }, + "NavItems": { + "type": "component", + "repeatable": true, + "component": "link.link" + } + } +} diff --git a/strapi/tsconfig.json b/strapi/tsconfig.json index e6663b0..e109d04 100644 --- a/strapi/tsconfig.json +++ b/strapi/tsconfig.json @@ -13,6 +13,7 @@ ".tmp/", "src/admin/", "**/*.test.*", - "src/plugins/**" + "src/plugins/**", + "types/generated/**" ] } diff --git a/web/astro.config.mjs b/web/astro.config.mjs index 1a2de5f..748838c 100644 --- a/web/astro.config.mjs +++ b/web/astro.config.mjs @@ -1,8 +1,8 @@ -import { defineConfig } from "astro/config"; import mdx from "@astrojs/mdx"; +import netlify from "@astrojs/netlify"; import sitemap from "@astrojs/sitemap"; import tailwind from "@astrojs/tailwind"; -import netlify from "@astrojs/netlify"; +import { defineConfig } from "astro/config"; import react from "@astrojs/react"; diff --git a/web/public/primary_1024.png b/web/public/primary_1024.png new file mode 100644 index 0000000..3963e29 Binary files /dev/null and b/web/public/primary_1024.png differ diff --git a/web/public/primary_512.png b/web/public/primary_512.png new file mode 100644 index 0000000..2592660 Binary files /dev/null and b/web/public/primary_512.png differ diff --git a/web/public/primary_black_1024.png b/web/public/primary_black_1024.png new file mode 100644 index 0000000..f7635d2 Binary files /dev/null and b/web/public/primary_black_1024.png differ diff --git a/web/public/primary_white_1024.png b/web/public/primary_white_1024.png new file mode 100644 index 0000000..3cb339b Binary files /dev/null and b/web/public/primary_white_1024.png differ diff --git a/web/src/components/Header.astro b/web/src/components/Header.astro deleted file mode 100644 index 0d9e0eb..0000000 --- a/web/src/components/Header.astro +++ /dev/null @@ -1,67 +0,0 @@ ---- -import HeaderLink from "./HeaderLink.astro"; -import { SITE_TITLE } from "../consts"; -import { Image, getImage } from "astro:assets"; - -import HomeIconSrc from "../../public/Vector.svg"; -const HomeIcon = await getImage({ src: HomeIconSrc }); ---- - - - -
- -
diff --git a/web/src/components/navigation/Header.tsx b/web/src/components/navigation/Header.tsx new file mode 100644 index 0000000..9238c21 --- /dev/null +++ b/web/src/components/navigation/Header.tsx @@ -0,0 +1,116 @@ +interface NavItem { + href: string; + value: string; +} + +interface HeaderProps { + logoUrl: string; + logoAlt: string; + navItems: NavItem[]; +} + +const Header = ({ logoUrl, logoAlt, navItems }: HeaderProps) => { + const currentPath = window.location.pathname; + const openMenu = () => { + // Disable scrolling + const body = document.querySelector("body"); + if (body) body.style.overflowY = "hidden"; + + // Show menu + const menu = document.querySelector("#hamburg-options"); + if (menu) menu.style.display = "flex"; + }; + + const closeMenu = () => { + // Enable scrolling + const body = document.querySelector("body"); + if (body) body.style.overflowY = "auto"; + + // Hide menu + const menu = document.querySelector("#hamburg-options"); + if (menu) menu.style.display = "none"; + }; + + return ( +
+ +
+ ); +}; + +export default Header; diff --git a/web/src/layouts/layout.astro b/web/src/layouts/layout.astro index e75d34a..f30ac01 100644 --- a/web/src/layouts/layout.astro +++ b/web/src/layouts/layout.astro @@ -1,7 +1,10 @@ --- -import BaseHead from "../components/BaseHead.astro"; +import BaseHead from "@/components/BaseHead.astro"; +import Header from "@/components/navigation/Header"; +import fetchApi from "@/lib/strapi"; +import { getImage } from "astro:assets"; +import TopographicImageSrc from "../../public/Topographic 3.svg"; import Footer from "../components/Footer.astro"; -import Header from "../components/Header.astro"; interface Props { title: string; @@ -9,10 +12,18 @@ interface Props { } const { title, description }: Props = Astro.props; +const STRAPI_URL = import.meta.env.STRAPI_URL; -import { getImage } from "astro:assets"; +const global = await fetchApi({ + endpoint: "global?populate[Navbar][populate]=*", + wrappedByKey: "data", +}); + +const logoUrl = + STRAPI_URL + global.attributes.Navbar.logo.data.attributes.formats.large.url; +const logoAlt = global.attributes.Navbar.logo.data.attributes.alternativeText; +const navItems = global.attributes.Navbar.NavItems; -import TopographicImageSrc from "../../public/Topographic 3.svg"; const TopographicImage = await getImage({ src: TopographicImageSrc }); --- @@ -21,12 +32,16 @@ const TopographicImage = await getImage({ src: TopographicImageSrc }); - -
+
- +