-
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
Showing
12 changed files
with
161 additions
and
107 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
import Close from "../Icons/Close.astro"; | ||
import Github from "../Icons/Github.astro"; | ||
import Hamburger from "../Icons/Hamburger.astro"; | ||
import Home from "../Icons/Home.astro"; | ||
import NavLink from "./Nav/Link.astro"; | ||
import { type Page } from "./Nav/Link.astro"; | ||
interface Props { | ||
pages: Page[]; | ||
customClasses?: string; | ||
} | ||
const { pages, customClasses } = Astro.props; | ||
--- | ||
|
||
<header | ||
class="flex flex-row p-5 justify-between text-2xl" | ||
class:list={customClasses} | ||
> | ||
<a href="/"> | ||
<Home /> | ||
</a> | ||
<nav class="flex gap-3"> | ||
<label id="nav-menu-mobile" class="block md:hidden relative"> | ||
<input | ||
type="checkbox" | ||
name="hamburger-input" | ||
id="hamburger-input" | ||
class="peer hidden" | ||
/> | ||
|
||
<!-- Do this thios way so that we can correctly use the sibling selector --> | ||
<div class="items-center hidden peer-checked:inline-flex"> | ||
<Close /> | ||
</div> | ||
<div class="inline-flex items-center peer-checked:hidden"> | ||
<Hamburger /> | ||
</div> | ||
</label> | ||
|
||
<a href="https://github.com/Naapperas"> | ||
<Github /> | ||
</a> | ||
</nav> | ||
</header> |
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,50 @@ | ||
--- | ||
import Icon from "../../Icons/Icon.astro"; | ||
export type Page = { | ||
name: string; | ||
url: string; | ||
icon?: { | ||
pack: string; | ||
name: string; | ||
enabled: boolean; | ||
}; | ||
}; | ||
export const backgroundColorForPageLink = ( | ||
url: URL, | ||
page: Page, | ||
): Record<string, boolean> => ({ | ||
"bg-color-4": url.pathname.includes(page.url), | ||
"text-color-1": url.pathname.includes(page.url), | ||
}); | ||
export const hasIcon = ( | ||
page: Page, | ||
): page is Omit<Page, "icon"> & { icon: NonNullable<Page["icon"]> } => { | ||
return page.icon !== undefined && page.icon.enabled; | ||
}; | ||
interface Props { | ||
page: Page; | ||
} | ||
const { page } = Astro.props; | ||
--- | ||
|
||
<li | ||
class:list={[ | ||
"h-full flex flex-col justify-center p-1", | ||
{ ...backgroundColorForPageLink(Astro.url, page) }, | ||
]} | ||
> | ||
<a title={page.name} href={page.url}> | ||
{ | ||
hasIcon(page) ? ( | ||
<Icon pack={page.icon.pack} name={page.icon.name} /> | ||
) : ( | ||
page.name | ||
) | ||
} | ||
</a> | ||
</li> |
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,32 @@ | ||
--- | ||
import Github from "../Icons/Github.astro"; | ||
import Home from "../Icons/Home.astro"; | ||
import NavLink from "./Nav/Link.astro"; | ||
import { type Page } from "./Nav/Link.astro"; | ||
interface Props { | ||
pages: Page[]; | ||
customClasses?: string; | ||
} | ||
const { pages, customClasses } = Astro.props; | ||
--- | ||
|
||
<header | ||
class="flex flex-row p-5 justify-between text-2xl" | ||
class:list={customClasses} | ||
> | ||
<a href="/"> | ||
<Home /> | ||
</a> | ||
<nav class="w-max"> | ||
<ul class="flex gap-4 h-full"> | ||
{pages.map((page) => <NavLink page={page} />)} | ||
</ul> | ||
</nav> | ||
<a href="https://github.com/Naapperas"> | ||
<Github /> | ||
</a> | ||
</header> |
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
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,9 +1,9 @@ | ||
--- | ||
import Icon, {type Props as IconProps} from "./Icon.astro"; | ||
import Icon, { type Props as IconProps } from "./Icon.astro"; | ||
type Props = Pick<IconProps, "iconClasses" >; | ||
type Props = Pick<IconProps, "iconClasses">; | ||
const {iconClasses} = Astro.props; | ||
const { iconClasses } = Astro.props; | ||
--- | ||
|
||
<Icon pack="mdi" name="github" iconClasses={iconClasses}/> | ||
<Icon pack="mdi" name="github" iconClasses={iconClasses} title="Github" /> |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
import Icon, { type Props as IconProps } from "./Icon.astro"; | ||
type Props = Pick<IconProps, "iconClasses">; | ||
const { iconClasses } = Astro.props; | ||
--- | ||
|
||
<Icon pack="ic" name="round-home" iconClasses={iconClasses} title="Menu" /> |
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
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