feat: add portfolio button and dominant button controls

This commit is contained in:
eggy 2023-01-23 19:57:22 -05:00
parent a7f38e77ae
commit 25f9e25b3e
3 changed files with 56 additions and 4 deletions

View File

@ -26,7 +26,12 @@ const getSvgIcon = async (name: string) => {
</svg> </svg>
</label> </label>
<div class="drawer prose dark:prose-invert"> <div class="drawer prose dark:prose-invert">
<li class="m-0" v-for="(item, index) in navItems" :key="index"> <li
class="m-0"
v-for="(item, index) in navItems"
:key="index"
:class="{ dominant: item.dominant }"
>
<!-- stupid vite doesn't let require work <!-- stupid vite doesn't let require work
i should have just hardcoded the navbar items --> i should have just hardcoded the navbar items -->
<a :href="item.href" class="p-2 flex gap-2"> <a :href="item.href" class="p-2 flex gap-2">
@ -36,6 +41,11 @@ const getSvgIcon = async (name: string) => {
preload="auto" preload="auto"
/> />
{{ item.title }} {{ item.title }}
<img
v-if="item.dominant"
src="/icons/arrow-right-line.svg"
class="m-0"
/>
</a> </a>
<hr class="m-0 m-2" v-if="index !== navItems.length - 1" /> <hr class="m-0 m-2" v-if="index !== navItems.length - 1" />
</li> </li>
@ -133,6 +143,20 @@ html.dark .drawer {
width: 100%; width: 100%;
} }
.drawer li.dominant a {
background: royalblue;
color: white;
font-weight: bold;
}
.drawer li.dominant img {
filter: invert(1);
}
.drawer li.dominant a:hover {
background: skyblue;
}
.drawer li a { .drawer li a {
/* overwrite tailwind */ /* overwrite tailwind */
text-decoration: none; text-decoration: none;

View File

@ -9,11 +9,16 @@ const props = defineProps<{ activeItem?: string }>();
<nav class="flex items-center justify-between"> <nav class="flex items-center justify-between">
<ul> <ul>
<li class="home-text"><a href="/">Eggworld</a></li> <li class="home-text"><a href="/">Eggworld</a></li>
<li v-for="(item, index) in navItems" :key="index"> <li
v-for="(item, index) in navItems"
:key="index"
:class="{ dominant: item.dominant }"
>
<a :href="item.href" class="flex gap-2"> <a :href="item.href" class="flex gap-2">
<img :src="`/nav/${item.title.toLowerCase()}.svg`" /> <img :src="`/nav/${item.title.toLowerCase()}.svg`" />
{{ item.title }}</a {{ item.title }}
> <img v-if="item.dominant" src="/icons/arrow-right-line.svg" />
</a>
</li> </li>
</ul> </ul>
<div class="flex items-center"> <div class="flex items-center">
@ -74,6 +79,20 @@ li.home-text {
font-weight: bold; font-weight: bold;
} }
li.dominant {
background: royalblue;
color: white;
font-weight: bold;
}
li.dominant:hover {
background: skyblue;
}
li.dominant img {
filter: invert(1);
}
.hamburger { .hamburger {
width: 0rem; width: 0rem;
opacity: 0; opacity: 0;
@ -87,6 +106,14 @@ li.home-text {
filter var(--trans), padding-left var(--trans), padding-right var(--trans); filter var(--trans), padding-left var(--trans), padding-right var(--trans);
} }
@media screen and (max-width: 750px) and (min-width: 601px) {
li.home-text {
width: 0;
opacity: 0;
padding: 0;
}
}
@media screen and (max-width: 600px) { @media screen and (max-width: 600px) {
.hamburger { .hamburger {
display: flex; display: flex;

View File

@ -2,6 +2,7 @@ export const navItems = [
{ href: "/#about", title: "About" }, { href: "/#about", title: "About" },
{ href: "/blog", title: "Blog" }, { href: "/blog", title: "Blog" },
{ href: "/stories", title: "Stories" }, { href: "/stories", title: "Stories" },
{ href: "https://portfolio.eggworld.me", title: "Portfolio", dominant: true },
]; ];
export default navItems; export default navItems;