-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
287daa4
commit 2ce53c9
Showing
9 changed files
with
416 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,53 @@ | ||
--- | ||
import { t } from "i18next"; | ||
import NavigationItem from './NavigationItem.astro' | ||
import NavigationButton from './NavigationButton.astro' | ||
type NavItemProps = Omit<Parameters<typeof NavigationItem>[0], 'index'>; | ||
const navItems = [ | ||
{ | ||
label: 'Haydn Comley', | ||
href: '/' | ||
}, | ||
{ | ||
label: 'About', | ||
href: '/about' | ||
}, | ||
{ | ||
label: 'Contact', | ||
href: '/contact', | ||
}, | ||
] as const satisfies NavItemProps[]; | ||
--- | ||
|
||
<nav class="nav"> | ||
<div> | ||
</div> | ||
|
||
<ul class="nav__items"> | ||
<li class="nav__items__link" id="welcome"> | ||
<a href="#welcome"> | ||
H.1 | ||
|
||
<span class="nav__items__link__desc"> | ||
- Welcome | ||
</span> | ||
</a> | ||
</li> | ||
|
||
<li class="nav__items__link" id="another"> | ||
<a href="#another"> | ||
H.2 | ||
<ul class="navLinks"> | ||
{ navItems.map((item, index) => ( | ||
<NavigationItem {...item} index={index}></NavigationItem> | ||
)) } | ||
|
||
<span class="nav__items__link__desc"> | ||
- About | ||
</span> | ||
</a> | ||
</li> | ||
|
||
<li class="nav__items__link" id="something"> | ||
<a href="#something"> | ||
H.3 | ||
<NavigationButton></NavigationButton> | ||
</ul> | ||
</nav> | ||
|
||
<span class="nav__items__link__desc"> | ||
- Contact | ||
</span> | ||
</a> | ||
</li> | ||
<style lang="scss"> | ||
.nav { | ||
border-bottom: var(--border); | ||
display: flex; | ||
justify-content: space-between; | ||
z-index: 10; | ||
position: sticky; | ||
top: 0; | ||
background-color: var(--background); | ||
} | ||
|
||
<button class="nav__items__link nav__items__burger"> | ||
|
||
</button> | ||
</ul> | ||
</nav> | ||
.navLinks { | ||
display: flex; | ||
list-style: none; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
<span class="navBurgerWrapper"> | ||
<a class="navBurger" id="menu" href="#menu"> | ||
<span class="navBurgerRow"> | ||
<span class="navBurgerDot"></span> | ||
<span class="navBurgerDot"></span> | ||
<span class="navBurgerDot"></span> | ||
</span> | ||
<span class="navBurgerRow"> | ||
<span class="navBurgerDot"></span> | ||
<span class="navBurgerDot"></span> | ||
<span class="navBurgerDot"></span> | ||
</span> | ||
<span class="navBurgerRow"> | ||
<span class="navBurgerDot"></span> | ||
<span class="navBurgerDot"></span> | ||
<span class="navBurgerDot"></span> | ||
</span> | ||
</a> | ||
|
||
<a class="navBurgerClose" href="#"></a> | ||
</span> | ||
|
||
<style lang="scss"> | ||
$size: 2.8rem; | ||
$dotSize: 4px; | ||
$gap: $dotSize; | ||
$gapClose: 2px; | ||
|
||
.navBurgerWrapper { | ||
position: relative; | ||
} | ||
|
||
.navBurger { | ||
position: relative; | ||
height: $size; | ||
width: $size; | ||
border-left: var(--border); | ||
background-color: var(--contrast); | ||
transition: var(--transitionSlow); | ||
display: flex; | ||
gap: $gap; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
|
||
&:not(:target):hover { | ||
gap: 0; | ||
background-color: var(--secondary); | ||
|
||
.navBurgerRow { | ||
gap: 0; | ||
|
||
&:nth-child(1) { | ||
.navBurgerDot { | ||
&:nth-child(1), &:nth-last-child(1) { | ||
background-color: transparent; | ||
} | ||
} | ||
} | ||
|
||
&:nth-last-child(1) { | ||
.navBurgerDot { | ||
&:nth-child(1), &:nth-last-child(1) { | ||
background-color: transparent; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
&:target { | ||
gap: 0; | ||
background-color: var(--primary); | ||
|
||
.navBurgerRow { | ||
gap: 0; | ||
transform: rotateZ(-360deg); | ||
|
||
&:nth-child(1) { | ||
.navBurgerDot { | ||
&:nth-child(2) { | ||
background-color: transparent; | ||
} | ||
} | ||
} | ||
|
||
&:nth-child(2) { | ||
.navBurgerDot { | ||
&:nth-child(1), &:nth-last-child(1) { | ||
background-color: transparent; | ||
} | ||
} | ||
} | ||
|
||
&:nth-last-child(1) { | ||
.navBurgerDot { | ||
&:nth-child(2) { | ||
background-color: transparent; | ||
} | ||
} | ||
} | ||
} | ||
|
||
&~.navBurgerClose { | ||
pointer-events: all; | ||
} | ||
} | ||
} | ||
|
||
.navBurgerRow { | ||
display: flex; | ||
gap: $gap; | ||
transition: var(--transitionSlow); | ||
} | ||
|
||
.navBurgerDot { | ||
height: $dotSize; | ||
width: $dotSize; | ||
background-color: var(--background); | ||
transition: var(--transitionSlow); | ||
} | ||
|
||
.navBurgerClose { | ||
position: absolute; | ||
left: 0; | ||
top: 0; | ||
width: 100%; | ||
height: 100%; | ||
z-index: 1; | ||
pointer-events: none; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
--- | ||
interface Props { | ||
href: string; | ||
label: string; | ||
index: number; | ||
} | ||
const { href, label, index } = Astro.props; | ||
const isActive = Astro.url.pathname === href; | ||
--- | ||
|
||
<li class="navItem" id={ href }> | ||
<a href={ '#' + href }> | ||
0.{ index + 1 } | ||
|
||
<span> | ||
{ label } | ||
</span> | ||
</a> | ||
</li> | ||
|
||
<style lang="scss"> | ||
.navItem { | ||
transition: var(--transitionSlow); | ||
border-left: var(--border); | ||
position: relative; | ||
display: flex; | ||
align-items: center; | ||
white-space: nowrap; | ||
|
||
a { | ||
position: relative; | ||
text-decoration: none; | ||
margin: 0; | ||
padding: var(--padding); | ||
color: var(--contrast); | ||
display: grid; | ||
grid-template-columns: auto 0fr; | ||
transition: grid-template-columns var(--transitionSlow); | ||
z-index: 1; | ||
|
||
&::before { | ||
position: absolute; | ||
content: ''; | ||
left: 25%; | ||
right: 75%; | ||
opacity: 0; | ||
bottom: 50%; | ||
height: 1px; | ||
background-color: var(--contrast); | ||
transform: translateY(.5em); | ||
transition: var(--transition); | ||
} | ||
} | ||
|
||
span { | ||
overflow: hidden; | ||
transition: var(--transitionSlow); | ||
color: var(--background); | ||
position: relative; | ||
|
||
&::before { | ||
content: ''; | ||
position: absolute; | ||
left: 0; | ||
top: 50%; | ||
width: .2em; | ||
height: .2em; | ||
border-radius: 50%; | ||
transform: translate(0%, 0%); | ||
background-color: var(--background); | ||
opacity: 0; | ||
transition: var(--transition); | ||
transition-delay: .4s; | ||
} | ||
} | ||
|
||
&::before { | ||
content: ''; | ||
position: absolute; | ||
right: 0; | ||
top: 0; | ||
bottom: 0; | ||
width: 0%; | ||
background-color: var(--contrast); | ||
} | ||
|
||
&:hover { | ||
a { | ||
&::before { | ||
right: 25%; | ||
opacity: 1; | ||
} | ||
} | ||
} | ||
|
||
&:target { | ||
&::before { | ||
width: 100%; | ||
} | ||
|
||
a { | ||
color: var(--background); | ||
grid-template-columns: auto 1fr; | ||
} | ||
|
||
span { | ||
margin-left: .5rem; | ||
padding-left: .5rem; | ||
|
||
&::before { | ||
opacity: 1; | ||
} | ||
} | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<div class="navMenu"> | ||
|
||
</div> | ||
|
||
<style lang="scss"> | ||
.navMenu { | ||
position: fixed; | ||
left: 0; | ||
top: 0; | ||
width: 100%; | ||
height: 0%; | ||
background-color: var(--contrast); | ||
pointer-events: none; | ||
transition: var(--transitionSlow); | ||
} | ||
|
||
body:has(#menu:target) { | ||
.navMenu { | ||
height: 100%; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.