aboutsummaryrefslogtreecommitdiff
path: root/src/components/navigation/navigation_entry.vue
blob: 7d761395e54602c0bc237325188072e511d7e09d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<template>
<li class="NavigationEntry">
  <router-link
    class="menu-item"
    :to="item.routeObject || { name: (currentUser || item.anon) ? item.route : item.anonRoute, params: { username: currentUser.screen_name } }"
    >
    <FAIcon
      v-if="item.icon"
      fixed-width
      class="fa-scale-110"
      :icon="item.icon"
      />
    <span
      class="icon iconLetter fa-scale-110"
      v-if="item.iconLetter"
      >{{ item.iconLetter }}
    </span>{{ item.labelRaw || $t(item.label) }}
    <button
      type="button"
      class="button-unstyled"
      @click.stop.prevent="togglePin(item.name)"
      >
      <FAIcon
        v-if="showPin"
        fixed-width
        class="fa-scale-110"
        :class="{ 'veryfaint': !isPinned(item.name) }"
        :transform="!isPinned(item.name) ? 'rotate-45' : ''"
        icon="thumbtack"
        />
      <div
        v-if="item.badgeGetter && getters[item.badgeGetter]"
        class="badge badge-notification"
        >
        {{ getters[item.badgeGetter] }}
      </div>
    </button>
  </router-link>
</li>
</template>

<script src="./navigation_entry.js"></script>

<style lang="scss">
@import '../../_variables.scss';

.NavigationEntry {
  .fa-scale-110 {
    margin-right: 0.8em;
  }

  .badge {
    position: absolute;
    right: 0.6rem;
    top: 1.25em;
  }

  .menu-item {
    display: block;
    box-sizing: border-box;
    height: 3.5em;
    line-height: 3.5em;
    padding: 0 1em;
    width: 100%;
    color: $fallback--link;
    color: var(--link, $fallback--link);

    &:hover {
      background-color: $fallback--lightBg;
      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);
      --icon: var(--selectedMenuIcon, $fallback--icon);
    }

    &.router-link-active {
      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);
      --icon: var(--selectedMenuIcon, $fallback--icon);

      &:hover {
        text-decoration: underline;
      }
    }
  }
}
</style>