|
| 1 | +<template> |
| 2 | + <transition name="fade-left-in-out"> |
| 3 | + <div |
| 4 | + v-if="isOpen" |
| 5 | + class="menu bg-black pt-2xlarge pl-small pr-small"> |
| 6 | + <transition :name="linksOpen ? 'fade-left' : 'fade-right'" mode="out-in"> |
| 7 | + <div v-if="!linksOpen" key="1" class="pl-2xsmall"> |
| 8 | + <div |
| 9 | + v-for="item in $tm('navbar.items')" |
| 10 | + :key="item"> |
| 11 | + <button |
| 12 | + :name="`go-to-${item}`" |
| 13 | + class="mb-small mt-xsmall color-white font-title type-uppercase" |
| 14 | + @click="scrollTo(item)"> |
| 15 | + {{ item }} |
| 16 | + </button> |
| 17 | + </div> |
| 18 | + <button |
| 19 | + class="mt-xsmall color-white font-title type-uppercase" |
| 20 | + @click="linksOpen = true"> |
| 21 | + {{ $t('navbar.dropdownName') }} |
| 22 | + </button> |
| 23 | + </div> |
| 24 | + <div v-else key="2" class="pl-2xsmall"> |
| 25 | + <button |
| 26 | + class="color-white font-title type-uppercase" |
| 27 | + @click="linksOpen = false"> |
| 28 | + <div class="flex middle mb-small" style="margin-left: -0.5rem;"> |
| 29 | + <chevron-icon direction="left" color="white" :size="32" /> |
| 30 | + <div> |
| 31 | + {{ $t('navbar.dropdownName') }} |
| 32 | + </div> |
| 33 | + </div> |
| 34 | + </button> |
| 35 | + <div |
| 36 | + v-for="{ name, url, description } in $tm('navbar.dropdown')" |
| 37 | + :key="name" |
| 38 | + class=""> |
| 39 | + <a |
| 40 | + :href="url"> |
| 41 | + {{ name }} |
| 42 | + </a> |
| 43 | + <p class="type-small color-white"> |
| 44 | + {{ description }} |
| 45 | + </p> |
| 46 | + </div> |
| 47 | + </div> |
| 48 | + </transition> |
| 49 | + </div> |
| 50 | + </transition> |
| 51 | + <div |
| 52 | + class="navbar row between bg-black color-white" |
| 53 | + :class="isOpen ? 'open' : ''"> |
| 54 | + <button |
| 55 | + class="hamburger" |
| 56 | + :class="isOpen ? 'open' : ''" |
| 57 | + @click="isOpen = !isOpen; linksOpen = false"> |
| 58 | + <span></span> |
| 59 | + <span></span> |
| 60 | + <span></span> |
| 61 | + <span></span> |
| 62 | + </button> |
| 63 | + <div class="logo-container flex middle pr-xsmall"> |
| 64 | + <div> |
| 65 | + <img :src="`${publicPath}img/RF-white.svg`" /> |
| 66 | + </div> |
| 67 | + </div> |
| 68 | + </div> |
| 69 | +</template> |
| 70 | + |
| 71 | +<script> |
| 72 | +import ChevronIcon from './icons/ChevronIcon.vue' |
| 73 | +
|
| 74 | +export default { |
| 75 | + name: 'NavMobile', |
| 76 | + components: { |
| 77 | + ChevronIcon |
| 78 | + }, |
| 79 | + data: () => ({ |
| 80 | + isOpen: false, |
| 81 | + linksOpen: false, |
| 82 | + publicPath: process.env.BASE_URL |
| 83 | + }) |
| 84 | +} |
| 85 | +</script> |
| 86 | + |
| 87 | +<style scoped> |
| 88 | +
|
| 89 | +.menu { |
| 90 | + position: fixed; |
| 91 | + z-index: 8; |
| 92 | + top: 0; |
| 93 | + width: 16rem; |
| 94 | + height: 100%; |
| 95 | + left: 0; |
| 96 | +} |
| 97 | +
|
| 98 | +.navbar { |
| 99 | + width: 100%; |
| 100 | + position: sticky; |
| 101 | + top: 0; |
| 102 | + left: 0; |
| 103 | + z-index: 9; |
| 104 | +} |
| 105 | +
|
| 106 | +.logo-container > div { |
| 107 | + display: contents; |
| 108 | +} |
| 109 | +.logo-container > div > img { |
| 110 | + width: 48px; |
| 111 | + height: 48px; |
| 112 | +} |
| 113 | +
|
| 114 | +.hamburger { |
| 115 | + margin: 16px; |
| 116 | + margin-left: 20px; |
| 117 | + width: 32px; |
| 118 | + height: 24px; |
| 119 | + position: relative; |
| 120 | + transform: rotate(0deg); |
| 121 | + transition: .2s ease-in-out; |
| 122 | + cursor: pointer; |
| 123 | +} |
| 124 | +.hamburger span { |
| 125 | + display: block; |
| 126 | + position: absolute; |
| 127 | + height: 4px; |
| 128 | + width: 100%; |
| 129 | + background: var(--color-white); |
| 130 | + border-radius: 1px; |
| 131 | + opacity: 1; |
| 132 | + left: 0; |
| 133 | + transform: rotate(0deg); |
| 134 | + transition: .25s ease-in-out; |
| 135 | +} |
| 136 | +.hamburger span:nth-child(1) { |
| 137 | + top: 0; |
| 138 | +} |
| 139 | +.hamburger span:nth-child(2),.hamburger span:nth-child(3) { |
| 140 | + top: 10px; |
| 141 | +} |
| 142 | +.hamburger span:nth-child(4) { |
| 143 | + top: 20px; |
| 144 | +} |
| 145 | +.hamburger.open span:nth-child(1) { |
| 146 | + top: 10px; |
| 147 | + width: 0%; |
| 148 | + left: 50%; |
| 149 | +} |
| 150 | +.hamburger.open span:nth-child(2) { |
| 151 | + transform: rotate(45deg); |
| 152 | +} |
| 153 | +.hamburger.open span:nth-child(3) { |
| 154 | + transform: rotate(-45deg); |
| 155 | +} |
| 156 | +.hamburger.open span:nth-child(4) { |
| 157 | + top: 10px; |
| 158 | + width: 0%; |
| 159 | + left: 50%; |
| 160 | +} |
| 161 | +
|
| 162 | +@media screen and (min-width: 769px) { |
| 163 | + .navbar, .menu { |
| 164 | + display: none; |
| 165 | + } |
| 166 | +} |
| 167 | +
|
| 168 | +</style> |
0 commit comments