From 997b850967df8dc03a7321b167dc9f7b52f98c7a Mon Sep 17 00:00:00 2001 From: Pauline Date: Sat, 14 Oct 2023 14:24:27 -0400 Subject: migrate(web): migrate from website/new-website to nexus/apps/website --- apps/website/src/components/base/Header.astro | 57 ++++++++++++++ apps/website/src/components/base/Navbar.astro | 21 ++++++ .../src/components/base/NavbarElement.astro | 86 ++++++++++++++++++++++ .../src/components/base/ScreenOverlay.astro | 16 ++++ .../base/ScrollbarOverlayContainer.astro | 51 +++++++++++++ apps/website/src/components/base/Tag.astro | 14 ++++ .../website/src/components/icons/ChevronDown.astro | 16 ++++ apps/website/src/components/logos/Logo.astro | 52 +++++++++++++ 8 files changed, 313 insertions(+) create mode 100644 apps/website/src/components/base/Header.astro create mode 100644 apps/website/src/components/base/Navbar.astro create mode 100644 apps/website/src/components/base/NavbarElement.astro create mode 100644 apps/website/src/components/base/ScreenOverlay.astro create mode 100644 apps/website/src/components/base/ScrollbarOverlayContainer.astro create mode 100644 apps/website/src/components/base/Tag.astro create mode 100644 apps/website/src/components/icons/ChevronDown.astro create mode 100644 apps/website/src/components/logos/Logo.astro (limited to 'apps/website/src/components') diff --git a/apps/website/src/components/base/Header.astro b/apps/website/src/components/base/Header.astro new file mode 100644 index 0000000..ad8267b --- /dev/null +++ b/apps/website/src/components/base/Header.astro @@ -0,0 +1,57 @@ +--- +import type { HTMLAttributes } from "astro/types" + +const sizes = { + "xl": "h1", + "lg": "h2", + "md": "h3", + "sm": "h4", + "xs": "h5", + "xxs": "h6" +}; + +type Headers = "h1" | "h2" | "h3" | "h4" | "h5" | "h6"; + +interface Props extends HTMLAttributes { + size: keyof typeof sizes; +} + +const { size, ...attr } = Astro.props; +const Element = sizes[size] as any; // Unfortunately gotta do this +--- + + + + + + \ No newline at end of file diff --git a/apps/website/src/components/base/Navbar.astro b/apps/website/src/components/base/Navbar.astro new file mode 100644 index 0000000..f4f2f49 --- /dev/null +++ b/apps/website/src/components/base/Navbar.astro @@ -0,0 +1,21 @@ +--- +import config from "config"; +import type { Config } from "@webtypes/Config"; +import NavbarElement from "./NavbarElement.astro"; + +--- + +
+ +
\ No newline at end of file diff --git a/apps/website/src/components/base/NavbarElement.astro b/apps/website/src/components/base/NavbarElement.astro new file mode 100644 index 0000000..4f82e8b --- /dev/null +++ b/apps/website/src/components/base/NavbarElement.astro @@ -0,0 +1,86 @@ +--- +import ChevronDown from "@components/icons/ChevronDown.astro"; +import type { LogoType, NavbarElement } from "@webtypes/Config"; +import ScreenOverlay from "./ScreenOverlay.astro"; +import Header from "./Header.astro"; +import Tag from "./Tag.astro"; +import Logo from "@components/logos/Logo.astro"; +import ScrollbarOverlayContainer from "./ScrollbarOverlayContainer.astro"; + +interface Props { + element: NavbarElement; + index: number; +} + +const { + element, + index +} = Astro.props; +--- + +
  • + +
  • \ No newline at end of file diff --git a/apps/website/src/components/base/ScreenOverlay.astro b/apps/website/src/components/base/ScreenOverlay.astro new file mode 100644 index 0000000..7be8bc5 --- /dev/null +++ b/apps/website/src/components/base/ScreenOverlay.astro @@ -0,0 +1,16 @@ +--- +import type { HTMLAttributes } from "astro/types"; + +interface Props extends HTMLAttributes<"div"> { + zIndex?: number; +} + +const { + zIndex = 0, + ...rest +} = Astro.props; +--- + +
    +
    +
    \ No newline at end of file diff --git a/apps/website/src/components/base/ScrollbarOverlayContainer.astro b/apps/website/src/components/base/ScrollbarOverlayContainer.astro new file mode 100644 index 0000000..d8d315d --- /dev/null +++ b/apps/website/src/components/base/ScrollbarOverlayContainer.astro @@ -0,0 +1,51 @@ +--- +import type { HTMLAttributes } from "astro/types"; + +interface Props extends HTMLAttributes<"div"> { + +} + +const { ...attr } = Astro.props; +--- + +
    + +
    + + \ No newline at end of file diff --git a/apps/website/src/components/base/Tag.astro b/apps/website/src/components/base/Tag.astro new file mode 100644 index 0000000..e6fd34f --- /dev/null +++ b/apps/website/src/components/base/Tag.astro @@ -0,0 +1,14 @@ +--- +import type { HTMLAttributes } from "astro/types"; + +interface Props extends HTMLAttributes<"span"> {} + +const { ...attr } = Astro.props; +--- + +
    + + + +
    + diff --git a/apps/website/src/components/icons/ChevronDown.astro b/apps/website/src/components/icons/ChevronDown.astro new file mode 100644 index 0000000..5cb98e4 --- /dev/null +++ b/apps/website/src/components/icons/ChevronDown.astro @@ -0,0 +1,16 @@ +--- +import type { HTMLAttributes } from 'astro/types'; + +interface Props extends HTMLAttributes<"svg"> { + size?: number; +} + +const { + size = 16, + ...attr +} = Astro.props; +--- + + + + \ No newline at end of file diff --git a/apps/website/src/components/logos/Logo.astro b/apps/website/src/components/logos/Logo.astro new file mode 100644 index 0000000..0532396 --- /dev/null +++ b/apps/website/src/components/logos/Logo.astro @@ -0,0 +1,52 @@ +--- +import type { LogoType } from "@webtypes/Config"; +import { dirname } from "path"; +import { fileURLToPath } from "url"; +import type { HTMLAttributes } from "astro/types"; + +export interface Props extends HTMLAttributes<"svg"> { + logo: LogoType, + size?: number | [number, number], + silent?: boolean, +} + +const { + logo, + silent = false, + size = undefined, + ...attr +} = Astro.props; +let svg: string | undefined; + +try { + if (logo == undefined) return; + const dir = dirname(fileURLToPath(import.meta.url)) + "/../../../public/media"; + svg = (await import(`${dir}/${logo.replaceAll(".", "/")}.svg?raw` /* @vite-ignore */)).default; + + if (svg == undefined) return; + + if (typeof size == "number" || Array.isArray(size)) { + // SVG main element regex + const svgElementRegex = /]*>/; + + svg = svg.replace(svgElementRegex, (match) => { + let newMatch = match; + if (typeof size == "number") { + newMatch = newMatch.replace(/width="[^"]*"/, `width="${size}"`); + newMatch = newMatch.replace(/height="[^"]*"/, `height="${size}"`); + } else if (Array.isArray(size)) { + newMatch = newMatch.replace(/width="[^"]*"/, `width="${size[0]}"`); + newMatch = newMatch.replace(/height="[^"]*"/, `height="${size[1]}"`); + } + return newMatch; + }); + } + + svg = svg.replace(/ `${key}="${value}"`).join(" ")}`); +} catch (err) { + if (typeof silent != "boolean" || silent == false) console.error(err); +} + +--- + + -- cgit