make custom router-link for nav-entry to un-nest the interactive elements
This commit is contained in:
parent
8b25febe36
commit
8ecb67230c
@ -121,7 +121,6 @@
|
|||||||
border-bottom: 1px solid;
|
border-bottom: 1px solid;
|
||||||
border-color: $fallback--border;
|
border-color: $fallback--border;
|
||||||
border-color: var(--border, $fallback--border);
|
border-color: var(--border, $fallback--border);
|
||||||
padding: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
> li {
|
> li {
|
||||||
@ -150,12 +149,6 @@
|
|||||||
font-size: 1.1em;
|
font-size: 1.1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-item {
|
|
||||||
.timelines-chevron {
|
|
||||||
margin-right: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.timelines-background {
|
.timelines-background {
|
||||||
padding: 0 0 0 0.6em;
|
padding: 0 0 0 0.6em;
|
||||||
background-color: $fallback--lightBg;
|
background-color: $fallback--lightBg;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import { USERNAME_ROUTES } from 'src/components/navigation/navigation.js'
|
import { USERNAME_ROUTES } from 'src/components/navigation/navigation.js'
|
||||||
|
import OptionalRouterLink from 'src/components/optional_router_link/optional_router_link.vue'
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
import { faThumbtack } from '@fortawesome/free-solid-svg-icons'
|
import { faThumbtack } from '@fortawesome/free-solid-svg-icons'
|
||||||
|
|
||||||
@ -7,6 +8,9 @@ library.add(faThumbtack)
|
|||||||
|
|
||||||
const NavigationEntry = {
|
const NavigationEntry = {
|
||||||
props: ['item', 'showPin'],
|
props: ['item', 'showPin'],
|
||||||
|
components: {
|
||||||
|
OptionalRouterLink
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
isPinned (value) {
|
isPinned (value) {
|
||||||
return this.pinnedItems.has(value)
|
return this.pinnedItems.has(value)
|
||||||
|
@ -1,26 +1,37 @@
|
|||||||
<template>
|
<template>
|
||||||
<li class="NavigationEntry">
|
<OptionalRouterLink
|
||||||
<component
|
ass="ass"
|
||||||
:is="routeTo ? 'router-link' : 'button'"
|
:to="routeTo"
|
||||||
class="menu-item button-unstyled"
|
v-slot="{ isActive, href, navigate } = {}"
|
||||||
:to="routeTo"
|
>
|
||||||
|
<li
|
||||||
|
class="NavigationEntry menu-item"
|
||||||
|
:class="{ '-active': isActive }"
|
||||||
|
v-bind="$attrs"
|
||||||
>
|
>
|
||||||
<span>
|
<component
|
||||||
<FAIcon
|
class="main-link button-unstyled"
|
||||||
v-if="item.icon"
|
:is="routeTo ? 'a' : 'button'"
|
||||||
fixed-width
|
:href="href"
|
||||||
class="fa-scale-110 menu-icon"
|
@click="navigate"
|
||||||
:icon="item.icon"
|
>
|
||||||
/>
|
<span>
|
||||||
</span>
|
<FAIcon
|
||||||
<span
|
v-if="item.icon"
|
||||||
v-if="item.iconLetter"
|
fixed-width
|
||||||
class="icon iconLetter fa-scale-110 menu-icon"
|
class="fa-scale-110 menu-icon"
|
||||||
>{{ item.iconLetter }}
|
:icon="item.icon"
|
||||||
</span>
|
/>
|
||||||
<span class="label">
|
</span>
|
||||||
{{ item.labelRaw || $t(item.label) }}
|
<span
|
||||||
</span>
|
v-if="item.iconLetter"
|
||||||
|
class="icon iconLetter fa-scale-110 menu-icon"
|
||||||
|
>{{ item.iconLetter }}
|
||||||
|
</span>
|
||||||
|
<span class="label">
|
||||||
|
{{ item.labelRaw || $t(item.label) }}
|
||||||
|
</span>
|
||||||
|
</component>
|
||||||
<slot />
|
<slot />
|
||||||
<div
|
<div
|
||||||
v-if="item.badgeGetter && getters[item.badgeGetter]"
|
v-if="item.badgeGetter && getters[item.badgeGetter]"
|
||||||
@ -45,8 +56,8 @@
|
|||||||
icon="thumbtack"
|
icon="thumbtack"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
</component>
|
</li>
|
||||||
</li>
|
</OptionalRouterLink>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script src="./navigation_entry.js"></script>
|
<script src="./navigation_entry.js"></script>
|
||||||
@ -55,7 +66,21 @@
|
|||||||
@import '../../_variables.scss';
|
@import '../../_variables.scss';
|
||||||
|
|
||||||
.NavigationEntry {
|
.NavigationEntry {
|
||||||
.label {
|
display: flex;
|
||||||
|
box-sizing: border-box;
|
||||||
|
align-items: baseline;
|
||||||
|
height: 3.5em;
|
||||||
|
line-height: 3.5em;
|
||||||
|
padding: 0 1em;
|
||||||
|
width: 100%;
|
||||||
|
color: $fallback--link;
|
||||||
|
color: var(--link, $fallback--link);
|
||||||
|
|
||||||
|
.timelines-chevron {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-link {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,48 +97,36 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-item {
|
&:hover {
|
||||||
display: flex;
|
background-color: $fallback--lightBg;
|
||||||
box-sizing: border-box;
|
background-color: var(--selectedMenu, $fallback--lightBg);
|
||||||
align-items: baseline;
|
|
||||||
height: 3.5em;
|
|
||||||
line-height: 3.5em;
|
|
||||||
padding: 0 1em;
|
|
||||||
width: 100%;
|
|
||||||
color: $fallback--link;
|
color: $fallback--link;
|
||||||
color: var(--link, $fallback--link);
|
color: var(--selectedMenuText, $fallback--link);
|
||||||
|
--faint: var(--selectedMenuFaintText, $fallback--faint);
|
||||||
|
--faintLink: var(--selectedMenuFaintLink, $fallback--faint);
|
||||||
|
--lightText: var(--selectedMenuLightText, $fallback--lightText);
|
||||||
|
|
||||||
&:hover {
|
.menu-icon {
|
||||||
background-color: $fallback--lightBg;
|
--icon: var(--text, $fallback--icon);
|
||||||
background-color: var(--selectedMenu, $fallback--lightBg);
|
}
|
||||||
color: $fallback--link;
|
}
|
||||||
color: var(--selectedMenuText, $fallback--link);
|
|
||||||
--faint: var(--selectedMenuFaintText, $fallback--faint);
|
|
||||||
--faintLink: var(--selectedMenuFaintLink, $fallback--faint);
|
|
||||||
--lightText: var(--selectedMenuLightText, $fallback--lightText);
|
|
||||||
|
|
||||||
.menu-icon {
|
&.-active {
|
||||||
--icon: var(--text, $fallback--icon);
|
font-weight: bolder;
|
||||||
}
|
background-color: $fallback--lightBg;
|
||||||
|
background-color: var(--selectedMenu, $fallback--lightBg);
|
||||||
|
color: $fallback--text;
|
||||||
|
color: var(--selectedMenuText, $fallback--text);
|
||||||
|
--faint: var(--selectedMenuFaintText, $fallback--faint);
|
||||||
|
--faintLink: var(--selectedMenuFaintLink, $fallback--faint);
|
||||||
|
--lightText: var(--selectedMenuLightText, $fallback--lightText);
|
||||||
|
|
||||||
|
.menu-icon {
|
||||||
|
--icon: var(--text, $fallback--icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.router-link-active {
|
&:hover {
|
||||||
font-weight: bolder;
|
text-decoration: underline;
|
||||||
background-color: $fallback--lightBg;
|
|
||||||
background-color: var(--selectedMenu, $fallback--lightBg);
|
|
||||||
color: $fallback--text;
|
|
||||||
color: var(--selectedMenuText, $fallback--text);
|
|
||||||
--faint: var(--selectedMenuFaintText, $fallback--faint);
|
|
||||||
--faintLink: var(--selectedMenuFaintLink, $fallback--faint);
|
|
||||||
--lightText: var(--selectedMenuLightText, $fallback--lightText);
|
|
||||||
|
|
||||||
.menu-icon {
|
|
||||||
--icon: var(--text, $fallback--icon);
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
22
src/components/optional_router_link/optional_router_link.vue
Normal file
22
src/components/optional_router_link/optional_router_link.vue
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<template>
|
||||||
|
<router-link
|
||||||
|
v-if="to"
|
||||||
|
:to="to"
|
||||||
|
custom
|
||||||
|
v-slot="props"
|
||||||
|
>
|
||||||
|
<slot
|
||||||
|
v-bind="props"
|
||||||
|
/>
|
||||||
|
</router-link>
|
||||||
|
<slot
|
||||||
|
v-else
|
||||||
|
v-bind="{}"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: ['to']
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Reference in New Issue
Block a user