| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <template>
- <nav class="main mobile">
- <button v-if="canGoBack" @click="router.back()">
- <IconBack />
- </button>
- <span>{{ title }}</span>
- <span class="button-placeholder"></span>
- </nav>
- </template>
- <script setup lang="ts">
- import { computed } from 'vue';
- import { useRouter } from 'vue-router'
- import IconBack from './icons/IconBack.vue';
- const router = useRouter();
- const canGoBack = computed(() => router.currentRoute.value.name !== 'Home');
- defineProps({
- title: {
- type: String,
- default: '',
- },
- })
- </script>
- <style lang="scss">
- @use '@/assets/scss/colors.scss' as *;
- $nav-height: 44px;
- nav.main.mobile {
- position: fixed;
- display: flex;
- justify-content: space-between;
- align-items: center;
- z-index: 100;
- width: 100%;
- height: $nav-height;
- padding: 0;
- background-color: $primary-color;
- border-bottom: 1px solid rgba(#fff, 0.2);
- color: #fff;
- transition: all ease-in-out 0.3s;
- button {
- width: $nav-height;
- height: $nav-height;
- cursor: pointer;
- display: flex;
- justify-content: center;
- align-items: center;
- color: #fff;
- background-color: transparent;
- outline: none;
- border: none;
- &:hover {
- background-color: rgba(#fff, 0.2);
- }
- svg {
- width: 25px;
- height: 25px;
- fill: currentColor;
- }
- }
- .button-placeholder {
- width: $nav-height;
- }
- }
- main.mobile-nav {
- .nav-placeholder {
- height: $nav-height;
- background-color: $primary-color;
- }
- }
- </style>
|