Skip to content

Commit

Permalink
Merge pull request #19 from tuatmcc/feat/navigation
Browse files Browse the repository at this point in the history
feat/navigation
  • Loading branch information
OJII3 authored Sep 4, 2024
2 parents f59b2c2 + c98b7ec commit 6157bee
Show file tree
Hide file tree
Showing 10 changed files with 154 additions and 87 deletions.
11 changes: 11 additions & 0 deletions public/assets/triangle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions public/icons/hamburger-black.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
12 changes: 12 additions & 0 deletions public/logos/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/textures/moonless_golf_1k.hdr
Binary file not shown.
23 changes: 23 additions & 0 deletions src/components/Container.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
---

<div class="h-dvh flex relative">
<div class="fixed w-32 h-32 top-0 z-10">
<img src="/logos/logo.svg" alt="MCC Logo" class="pl-8 pt-8 lg:h-40 lg:mr-[-200px]" />
</div>
<div class="w-full flex flex-col p-4 pt-16">
<div class="flex justify-end mb-[-1px]">
<svg width="70" height="140" viewBox="0 0 70 140" fill="none" xmlns="http://www.w3.org/2000/svg" class="mr-[-1px] text-blue-800">
<path d="M70 140H0C15 136 15 140 35 70C55 0 55 0 70 0V140Z" fill="currentColor"/>
</svg>
<div class="rounded-tr-2xl bg-blue-800 w-[calc(100%-200px)]" />
</div>
<div class="w-full h-full rounded-b-2xl rounded-l-2xl bg-blue-800 p-4">
<slot />
</div>
</div>
</div>

<style>
</style>
99 changes: 53 additions & 46 deletions src/components/Navigation/Navigation.astro
Original file line number Diff line number Diff line change
@@ -1,73 +1,80 @@
---
import { FaDiscord, FaGithub, FaXTwitter } from "react-icons/fa6";
import { NavigationContainer } from "./NavigationContainer.tsx";
import { FaXTwitter, FaGithub, FaDiscord } from "react-icons/fa6";
const links = [
{ href: "/", label: "Home" },
{ href: "/about", label: "About" },
{ href: "/achievements", label: "Achievements" },
{ href: "/blog", label: "Blog" },
];
const socialLinks = [
{ href: "https://x.com/tuatmcc", icon: FaXTwitter },
{ href: "https://x.com/tuatmcc", icon: FaGithub },
{ href: "https://x.com/tuatmcc", icon: FaDiscord },
];
---

<slot />
<NavigationContainer client:only="react">
<div class="w-full h-full pl-8 pt-24 overflow-y-auto flex flex-col justify-between">
<div
class="w-full h-full pl-8 pt-24 overflow-y-auto flex flex-col justify-between"
>
<ul class="flex flex-col gap-8">
{
links.map((link) => (
<li class="link-item relative flex text-white text-2xl font-orbitron tracking-wider">
<li class="link-item relative flex text-gray-100 text-2xl font-orbitron tracking-wider">
<a href={link.href} class=" flex justify-end w-full p-2">
{link.label}
</a>
</li>
))
}
</ul>
<div class="relative">
<div class="absolute top-0 right-0 w-[2px] bottom-0 bg-red-600" />
<ul class="relative flex flex-col gap-8 p-4">
<li class="flex">
<a href="https://x.com/tuatmcc" target="_blank" rel="noopener noreferrer" class="flex flex-1 justify-end">
<FaXTwitter className="text-white w-6 h-6" />
</a>
</li>
<li class="flex">
<a href="https://x.com/tuatmcc" target="_blank" rel="noopener noreferrer" class="flex flex-1 justify-end">
<FaGithub className="text-white w-6 h-6" />
</a>
</li>
<li class="flex">
<a href="https://x.com/tuatmcc" target="_blank" rel="noopener noreferrer" class="flex flex-1 justify-end">
<FaDiscord className="text-white w-6 h-6" />
</a>
</li>
</ul>
</div>
</NavigationContainer>

<style>
.link-item {
&::after {
position: absolute;
content: "";
display: block;
bottom: 0;
left: 50%;
width: 0;
bottom: 0;
height: 2px;
background: white;
transition: all 0.2s;
transform: translateX(-50%);
opacity: 0;
}
<div class="relative">
<div class="absolute top-0 right-0 w-[4px] bottom-0 bg-blue-600"></div>
<ul class="relative flex flex-col gap-8 p-4">
{
socialLinks.map((socialLink) => (
<li class="flex">
<a
href={socialLink.href}
target="_blank"
rel="noopener noreferrer"
class="flex flex-1 justify-end"
>
<socialLink.icon className="text-gray-200 w-6 h-6" />
</a>
</li>
))
}
</ul>
</div>
</div>

&:hover {
<style>
.link-item {
&::after {
width: 100%;
opacity: 1;
position: absolute;
content: "";
display: block;
bottom: 0;
right: 0;
width: 0;
bottom: 0;
height: 2px;
background: white;
transition: all 0.2s;
opacity: 0;
}

&:hover {
&::after {
width: 100%;
opacity: 1;
}
}
}
}
</style>
</style>
</NavigationContainer>
44 changes: 9 additions & 35 deletions src/components/Navigation/NavigationContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { type ReactNode, useState } from "react";

export const NavigationContainer = ({ children }: { children: ReactNode }) => {
const [active, setActive] = useState(false);

return (
<>
<AnimatePresence>
Expand All @@ -11,7 +12,7 @@ export const NavigationContainer = ({ children }: { children: ReactNode }) => {
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
className="fixed top-0 left-0 w-full h-dvh bg-black bg-opacity-30 backdrop-blur-sm"
className="fixed top-0 left-0 w-full h-dvh bg-black bg-opacity-40 backdrop-blur-sm z-10"
onClick={() => setActive(false)}
onKeyDown={(e) => e.key === "Escape" && setActive(false)}
/>
Expand All @@ -24,40 +25,13 @@ export const NavigationContainer = ({ children }: { children: ReactNode }) => {
aria-label="Menu Button"
onClick={() => setActive((prev) => !prev)}
>
<svg
className=""
width="40"
height="40"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<title>Menu</title>
<path
d="M4 6L20 6"
stroke="black"
stroke-width="2"
stroke-linecap="round"
/>
<path
d="M4 12L20 12"
stroke="black"
stroke-width="2"
stroke-linecap="round"
/>
<path
d="M4 18L20 18"
stroke="black"
stroke-width="2"
stroke-linecap="round"
/>
</svg>
<img src="/icons/hamburger-black.svg" alt="Menu" />
</button>
<motion.div
initial={{ x: "100%" }}
animate={{ x: active ? 0 : "100%" }}
transition={{ type: "spring", bounce: 0.1, duration: 0.3 }}
className="fixed grid top-0 bottom-0 right-0 w-[500px] max-w-[95vw]"
className="fixed grid top-0 bottom-0 right-0 w-[500px] max-w-[95vw] z-10"
style={{
clipPath:
"polygon(0 0, 0 30%, 60px calc(30% + 60px), 60px calc(100% - 160px), 0 calc(100% - 100px), 0 100%, 100% 100%, 100% 0)",
Expand All @@ -76,34 +50,34 @@ export const NavigationContainer = ({ children }: { children: ReactNode }) => {
aria-label="Menu Button"
onClick={() => setActive((prev) => !prev)}
>
<img src="/icons/hamburger.svg" alt="Close" />
<img src="/icons/hamburger-white.svg" alt="Close" />
</button>

{children}
</div>
<div
className="fixed top-0 h-[30%] w-[60px] bg-red-600"
className="fixed top-0 h-[30%] w-[60px] bg-blue-600"
style={{
clipPath:
"polygon(20px 0, 22px 0, 22px 20%, 60px calc(20% + 38px), 60px calc(20% + 50px), 20px calc(20% + 12px))",
}}
/>
<div
className="fixed top-0 h-[30%] w-[60px] bg-red-600"
className="fixed top-0 h-[30%] w-[60px] bg-blue-600"
style={{
clipPath:
"polygon(20px calc(20% + 22px), 60px calc(20% + 62px), 60px calc(20% + 74px), 20px calc(20% + 36px))",
}}
/>
<div
className="fixed top-0 h-[30%] w-[60px] bg-red-600"
className="fixed top-0 h-[30%] w-[60px] bg-blue-600"
style={{
clipPath:
"polygon(20px calc(20% + 46px), 60px calc(20% + 86px), 60px calc(20% + 98px), 20px calc(20% + 60px))",
}}
/>
<div
className="fixed top-0 h-[30%] w-[60px] bg-red-600"
className="fixed top-0 h-[30%] w-[60px] bg-blue-600"
style={{
clipPath:
"polygon(58px calc(20% + 86px), 60px calc(20% + 86px), 60px calc(20% + 160px), 58px calc(20% + 160px))",
Expand Down
2 changes: 1 addition & 1 deletion src/components/home/RecentNews.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const posts = (await getCollection("news")).sort(
);
---

<BeveledCard class="card fixed bottom-1/2 left-8 p-4 w-5/12 bg-gray-400">
<BeveledCard class="p-4 w-5/12 bg-gray-600">
<h2 class="font-orbitron text-4xl">Recent News</h2>
<ul class="content mt-2 flex flex-col gap-2">
<li class="flex">
Expand Down
32 changes: 27 additions & 5 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
---
import Container from "../components/Container.astro";
import Navigation from "../components/Navigation/Navigation.astro";
import RecentNews from "../components/home/RecentNews.astro";
import Layout from "../layouts/Layout.astro";
---

<Layout title="MCC" path="" og={{ enabled: true }} pagefind={false}>
<!-- <img src="/abstract-wave.jpg" class="absolute top-0 left-0 w-full h-full bg-black" /> -->
<Navigation>
<div class="h-svh flex flex-col items-center justify-center relative">
<img src="/animated_mcc.webp" alt="MCC Logo" class="w-80 h-80" />
</div>
<RecentNews />
<main class="main">
<!-- <div class="background-gradient fixed top-0 left-0 w-full h-full z-[-1]" /> -->
<div class="background-pattern fixed top-0 left-0 w-full h-full opacity-10 z-[-1]" />
<div class="sticky h-svh flex flex-col items-center justify-center top-0 z-[-1]">
<img src="/animated_mcc.webp" alt="MCC Logo" class="w-80 h-80" />
</div>
<Container>
<h1 class="text-4xl text-white tracking-wider font-orbitron text-center">Welcome to MCC</h1>
</Container>
</Navigation>
</main>
</Layout>

<style>
.background-pattern {
background-image: url("/assets/triangle.svg");
background-repeat: repeat;
background-size: 100px;
background-position: center;
}

.background-gradient {
background-image: linear-gradient(#fff, transparent, #ccc9, #ccc);
background-size: 100%;
background-repeat: no-repeat;
background-position: center;
}
</style>

0 comments on commit 6157bee

Please sign in to comment.