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>
</label>
<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
i should have just hardcoded the navbar items -->
<a :href="item.href" class="p-2 flex gap-2">
@ -36,6 +41,11 @@ const getSvgIcon = async (name: string) => {
preload="auto"
/>
{{ item.title }}
<img
v-if="item.dominant"
src="/icons/arrow-right-line.svg"
class="m-0"
/>
</a>
<hr class="m-0 m-2" v-if="index !== navItems.length - 1" />
</li>
@ -133,6 +143,20 @@ html.dark .drawer {
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 {
/* overwrite tailwind */
text-decoration: none;

View File

@ -9,11 +9,16 @@ const props = defineProps<{ activeItem?: string }>();
<nav class="flex items-center justify-between">
<ul>
<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">
<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>
</ul>
<div class="flex items-center">
@ -74,6 +79,20 @@ li.home-text {
font-weight: bold;
}
li.dominant {
background: royalblue;
color: white;
font-weight: bold;
}
li.dominant:hover {
background: skyblue;
}
li.dominant img {
filter: invert(1);
}
.hamburger {
width: 0rem;
opacity: 0;
@ -87,6 +106,14 @@ li.home-text {
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) {
.hamburger {
display: flex;

View File

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