Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions src/partials/SideNavPartial.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<div class="sticky top-0 w-16 md:w-24 shrink-0 h-screen overflow-y-auto no-scrollbar border-r border-slate-200 dark:border-slate-800">
<div class="h-full flex flex-col justify-between after:flex-1 after:mt-auto">
<!-- Sidebar avatar -->
<div v-if="!isHome && !isAbout" class="flex justify-center my-4">
<div class="flex justify-center my-4">
<router-link v-lazy-link to="/">
<AvatarPartial width="w-16" height="h-16" loading="lazy" decoding="async" fetchpriority="low" />
<AvatarPartial width="w-16" height="h-16" decoding="async" />
</router-link>
</div>

<!-- Sidebar menu-->
<div class="flex-1 grow flex items-start">
<nav :class="['w-full pb-10', navPaddingTopClass]">
<nav :class="['w-full pb-10 mt-2', navPaddingTopClass]">
<ul class="space-y-4">
<li class="py-2">
<!-- home -->
Expand Down Expand Up @@ -112,12 +112,6 @@ const navSocialLinks = useHeaderSocialLinks(social);

const { tooltip, showTooltip, hideTooltip } = useTooltip();

const isHome = computed<boolean>(() => {
// `path` excludes query strings, ensuring the avatar is hidden on the homepage
// even when query parameters are present (e.g. `/?foo=bar`).
return currentRoute.path === '/';
});

const isAbout = computed<boolean>(() => currentRoute.path === '/about');

const CONTENT_ALIGNED_ROUTES = new Set(['/about', '/projects', '/resume']);
Expand Down
8 changes: 4 additions & 4 deletions tests/partials/SideNavPartial.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,18 @@ describe('SideNavPartial', () => {
debugErrorMock.mockClear();
});

it('hides the avatar on the home route', async () => {
it('shows the avatar on the home route', async () => {
const { wrapper } = await mountSideNavAt('/');

expect(wrapper.findComponent(AvatarPartial).exists()).toBe(false);
expect(wrapper.findComponent(AvatarPartial).exists()).toBe(true);

wrapper.unmount();
});

it('hides the avatar on the about route', async () => {
it('shows the avatar on the about route', async () => {
const { wrapper } = await mountSideNavAt('/about');

expect(wrapper.findComponent(AvatarPartial).exists()).toBe(false);
expect(wrapper.findComponent(AvatarPartial).exists()).toBe(true);

wrapper.unmount();
});
Expand Down
Loading