Header.vue 1.7 KB
Newer Older
L
LeoKu 已提交
1 2 3 4 5 6 7 8 9 10 11 12
<template>
  <header class="header">
    <Logo />

    <h2 class="site-title">Color Avatar</h2>

    <div class="header-right">
      <a
        href="https://github.com/Codennnn/vue-color-avatar"
        target="_blank"
        rel="nofollow noopener noreferrer"
      >
L
LeoKu 已提交
13 14 15 16 17 18 19 20
        <button
          class="github-button"
          @click="
            recordEvent('click_github', {
              event_category: 'click',
            })
          "
        >
L
LeoKu 已提交
21
          <img :src="IconGitHub" alt="GitHub" />
L
LeoKu 已提交
22 23 24 25 26 27 28 29 30 31
          <span class="text">GitHub</span>
        </button>
      </a>
    </div>
  </header>
</template>

<script lang="ts" setup>
import IconGitHub from '@/assets/icons/icon-github.svg'
import Logo from '@/components/Logo.vue'
L
LeoKu 已提交
32
import { recordEvent } from '@/utils/ga'
L
LeoKu 已提交
33 34 35 36 37 38 39 40 41 42 43 44 45
</script>

<style lang="scss" scoped>
.header {
  display: flex;
  align-items: center;
  height: $layout-header-height;
  padding: 1rem 2rem;

  .site-title {
    margin-left: 1rem;
    font-weight: bold;
    font-size: 1.9rem;
L
LeoKu 已提交
46
    cursor: default;
L
LeoKu 已提交
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

    @media screen and (max-width: $screen-sm) {
      display: none;
    }
  }

  .header-right {
    margin-left: auto;

    .github-button {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 8rem;
      height: 2.5rem;
      color: $color-text;
      font-weight: bold;
      font-size: 1.05rem;
      background-color: $color-dark;
      border-radius: 0.6rem;
      cursor: pointer;
      transition: box-shadow 0.2s, background-color 0.2s;
      user-select: none;

      &:hover {
        background-color: lighten($color-dark, 2);
        box-shadow: 0 0.2rem 1.5rem 0.2rem lighten($color-dark, 5);
      }

      .text {
        margin-left: 0.5rem;
      }
    }
  }
}
</style>