api-client/components/app/Sidenav.vue

134 lines
2.9 KiB
Vue
Raw Normal View History

2020-03-04 01:17:02 +00:00
<template>
2021-08-09 12:25:30 +00:00
<aside class="flex h-full justify-between md:flex-col">
2021-08-05 15:59:05 +00:00
<nav class="flex flex-nowrap md:flex-col">
2021-08-09 12:25:30 +00:00
<NuxtLink
2021-07-01 16:39:11 +00:00
v-for="(navigation, index) in primaryNavigation"
:key="`navigation-${index}`"
:to="localePath(navigation.target)"
2021-07-07 23:28:42 +00:00
class="nav-link"
tabindex="0"
>
2021-07-30 08:22:43 +00:00
<i v-if="navigation.icon" class="material-icons">
{{ navigation.icon }}
</i>
2021-08-28 00:17:33 +00:00
<div v-if="navigation.svg">
2021-07-30 08:22:43 +00:00
<SmartIcon :name="navigation.svg" class="svg-icons" />
</div>
2021-08-24 08:15:11 +00:00
<span v-if="LEFT_SIDEBAR">{{ navigation.title }}</span>
<tippy
v-if="!LEFT_SIDEBAR"
:placement="windowInnerWidth.x.value >= 768 ? 'right' : 'bottom'"
theme="tooltip"
:content="navigation.title"
/>
2021-08-09 12:25:30 +00:00
</NuxtLink>
2021-07-01 16:39:11 +00:00
</nav>
</aside>
2020-03-04 01:17:02 +00:00
</template>
2021-08-09 12:25:30 +00:00
<script lang="ts">
2021-08-21 19:09:05 +00:00
import { defineComponent } from "@nuxtjs/composition-api"
import useWindowSize from "~/helpers/utils/useWindowSize"
2021-08-24 08:15:11 +00:00
import { useSetting } from "~/newstore/settings"
2021-08-09 12:25:30 +00:00
export default defineComponent({
2021-08-24 08:15:11 +00:00
setup() {
return {
windowInnerWidth: useWindowSize(),
2021-08-24 08:15:11 +00:00
LEFT_SIDEBAR: useSetting("LEFT_SIDEBAR"),
}
},
data() {
return {
2021-07-01 16:39:11 +00:00
primaryNavigation: [
2021-08-02 15:27:18 +00:00
{
target: "index",
2021-08-28 00:17:33 +00:00
svg: "link-2",
2021-08-02 15:27:18 +00:00
title: this.$t("navigation.rest"),
},
{
target: "graphql",
svg: "graphql",
title: this.$t("navigation.graphql"),
},
{
target: "realtime",
2021-08-28 00:17:33 +00:00
svg: "globe",
2021-08-02 15:27:18 +00:00
title: this.$t("navigation.realtime"),
},
{
target: "documentation",
2021-08-28 00:17:33 +00:00
svg: "book-open",
2021-08-02 15:27:18 +00:00
title: this.$t("navigation.doc"),
},
{
target: "settings",
2021-08-28 00:17:33 +00:00
svg: "settings",
2021-08-02 15:27:18 +00:00
title: this.$t("navigation.settings"),
},
],
}
},
2021-08-09 12:25:30 +00:00
})
2021-05-18 06:26:59 +00:00
</script>
2020-06-19 17:37:40 +00:00
<style scoped lang="scss">
2021-07-07 23:28:42 +00:00
.nav-link {
@apply relative;
2021-07-07 23:28:42 +00:00
@apply p-4;
2021-07-20 10:29:30 +00:00
@apply flex flex-col flex-1;
2021-07-07 23:28:42 +00:00
@apply items-center;
@apply justify-center;
2021-08-05 17:22:02 +00:00
@apply hover:(bg-primaryDark text-secondaryDark);
2021-08-17 07:26:36 +00:00
@apply focus-visible:text-secondaryDark;
&::after {
@apply absolute;
@apply inset-x-0;
@apply md:inset-x-auto;
@apply md:inset-y-0;
@apply bottom-0;
@apply md:bottom-auto;
@apply md:left-0;
@apply z-2;
@apply h-0.5;
@apply md:h-full;
@apply w-full;
@apply md:w-0.5;
content: "";
}
&:focus::after {
@apply bg-divider;
}
2021-07-07 23:28:42 +00:00
2021-07-30 08:22:43 +00:00
.material-icons,
.svg-icons {
2021-07-24 16:46:48 +00:00
@apply opacity-75;
2021-07-07 23:28:42 +00:00
}
span {
@apply mt-2;
@apply font-font-medium;
2021-08-28 00:17:33 +00:00
2021-08-28 15:18:13 +00:00
font-size: calc(var(--body-font-size) - 0.062rem);
2021-07-07 23:28:42 +00:00
}
2021-08-03 04:54:32 +00:00
&.exact-active-link {
2021-08-21 19:09:05 +00:00
@apply text-secondaryDark;
@apply bg-primaryLight;
@apply hover:text-secondaryDark;
2021-07-07 23:28:42 +00:00
2021-07-30 08:22:43 +00:00
.material-icons,
.svg-icons {
2021-07-07 23:28:42 +00:00
@apply opacity-100;
}
&::after {
@apply bg-accent;
}
2021-07-07 23:28:42 +00:00
}
2020-06-19 17:37:40 +00:00
}
</style>