Created dynamic navigation header component

This commit is contained in:
2025-01-10 14:03:06 +00:00
parent 27b748802a
commit 5414bf3c60
5 changed files with 59 additions and 16 deletions

View File

@@ -1,6 +1,7 @@
<script> <script>
import "./LandingPage.scss"; import "./LandingPage.scss";
import NavigationHeader from "../shared_components/NavigationHeader.svelte"; import NavigationHeader from "../shared_components/NavigationHeader.svelte";
import "./NavigationHeader.scss";
import NavigationFooter from "../shared_components/NavigationFooter.svelte"; import NavigationFooter from "../shared_components/NavigationFooter.svelte";
import Splash from "./Splash.svelte"; import Splash from "./Splash.svelte";
import InfoScroll from "./InfoScroll.svelte"; import InfoScroll from "./InfoScroll.svelte";
@@ -35,7 +36,13 @@
/> />
{/if} {/if}
<div class="landing-zone"> <div class="landing-zone">
<NavigationHeader /> <NavigationHeader
class="navigation-header"
items_class="navigation-header-items"
link_class="navigation-header-link"
button_class="navigation-header-button"
button_text_class="navigation-header-button-text"
/>
<Splash /> <Splash />
</div> </div>
</div> </div>

View File

@@ -18,10 +18,10 @@
.navigation-header-link { .navigation-header-link {
color: var(--cpalettelight); color: var(--cpalettelight);
font-family: var(--navigation-header-font-family);
text-align: left; text-align: left;
font-family: var(--navigation-header-link-font-family); font-size: var(--navigation-header-font-size);
font-size: var(--navigation-header-link-font-size); font-weight: var(--navigation-header-font-weight);
font-weight: var(--navigation-header-link-font-weight);
text-decoration: underline; text-decoration: underline;
position: relative; position: relative;
display: flex; display: flex;
@@ -44,7 +44,7 @@
0px 1px 2px 0px rgba(0, 0, 0, 0.05)); 0px 1px 2px 0px rgba(0, 0, 0, 0.05));
} }
.navigation-header-contact-us { .navigation-header-button-text {
@extend .navigation-header-link; @extend .navigation-header-link;
color: var(--background); color: var(--background);
text-decoration: none; text-decoration: none;

View File

@@ -0,0 +1,27 @@
<script>
export let text = "Link_Text";
export let redirectFunc = () => {};
export let hotkey = "";
function handleKeypress(event) {
if (
event.key === hotkey ||
event.key === "Enter" ||
event.key === " "
) {
event.preventDefault();
redirectFunc();
}
}
</script>
<div
class="cursor-pointer select-none {$$props.class}"
style="cursor: pointer;"
on:click={redirectFunc}
on:keydown={handleKeypress}
tabindex="0"
role="link"
>
{text}
</div>

View File

@@ -1,13 +1,22 @@
<script> <script>
import "./NavigationHeader.scss"; export let items_class;
export let link_class;
export let button_class;
export let button_text_class;
import Button from "../shared_components/Button.svelte";
import Link from "../shared_components/Link.svelte";
</script> </script>
<div class="navigation-header"> <div class={$$props.class}>
<div class="navigation-header-items"> <div class={items_class}>
<div class="navigation-header-link">Data Repository</div> <Link class={link_class} text="Data Repository" hotkey="d" />
<div class="navigation-header-link">How to Contribute</div> <Link class={link_class} text="How to Contribute" hotkey="h" />
<div class="navigation-header-button"> <Button
<div class="navigation-header-contact-us">Contact Us</div> class={button_class}
</div> text="Contact Us"
inner_class={button_text_class}
hotkey="c"
/>
</div> </div>
</div> </div>

View File

@@ -9,9 +9,9 @@
--cpalettecomplimentary: #ffffff; --cpalettecomplimentary: #ffffff;
/* For the navigation header on the landing page */ /* For the navigation header on the landing page */
--navigation-header-link-font-family: "Assistant", sans-serif; --navigation-header-font-family: "Assistant", sans-serif;
--navigation-header-link-font-size: 24px; --navigation-header-font-size: 24px;
--navigation-header-link-font-weight: 700; --navigation-header-font-weight: 700;
/* For the splash on the landing page */ /* For the splash on the landing page */
--splash-title-font-family: "Martel", sans-serif; --splash-title-font-family: "Martel", sans-serif;
--splash-title-font-size-large: 64px; --splash-title-font-size-large: 64px;