DownloadModal.vue 2.6 KB
Newer Older
L
LeoKu 已提交
1 2 3 4 5 6 7 8
<template>
  <div
    v-if="props.visible"
    class="download-modal-wrapper"
    @click="emit('close')"
  >
    <div class="download-modal" @click.stop>
      <div class="modal-body">
L
LeoKu 已提交
9
        <div class="avatar-preview">
L
LeoKu 已提交
10 11 12 13 14 15 16 17 18 19
          <img
            alt="vue-color-avatar"
            :src="props.imageUrl"
            class="avatar-img"
          />
        </div>

        <p class="tip">{{ t('text.downloadTip') }} 🥳</p>
      </div>

L
LeoKu 已提交
20
      <button type="button" class="close-btn" @click="emit('close')">
L
LeoKu 已提交
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
        {{ t('action.close') }}
      </button>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { useI18n } from 'vue-i18n'

const props = defineProps<{ visible?: boolean; imageUrl: string }>()

const emit = defineEmits<{
  (e: 'close'): void
}>()

const { t } = useI18n()
</script>

<style lang="scss" scoped>
40 41
@use 'src/styles/var';

L
LeoKu 已提交
42 43 44 45 46 47 48 49 50 51 52 53 54
.download-modal-wrapper {
  position: fixed;
  bottom: 0;
  left: 50%;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 2rem 0;
  overflow: hidden;
  transform: translate(-50%, 0);
L
LeoKu 已提交
55
  backdrop-filter: blur(0.3rem);
L
LeoKu 已提交
56 57

  @supports not (backdrop-filter: blur(0.3rem)) {
58
    background-color: rgba(var.$color-dark, 0.8);
L
LeoKu 已提交
59
  }
L
LeoKu 已提交
60 61 62 63 64 65 66
}

.download-modal {
  position: relative;
  width: 50%;
  min-width: 310px;
  max-width: 500px;
67 68
  background-color: darken(var.$color-dark, 1);
  border: 0.15rem solid rgba(var.$color-accent, 0.8);
L
LeoKu 已提交
69 70 71 72 73 74 75 76 77 78
  border-radius: 1rem;

  .modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 1.8rem 1.2rem 1rem 1.2rem;

L
LeoKu 已提交
79
    .avatar-preview {
L
LeoKu 已提交
80 81 82
      width: 60%;
      margin: 0 auto;

83
      @media screen and (max-width: var.$screen-md) {
L
LeoKu 已提交
84 85 86
        width: 80%;
      }

87
      @media screen and (max-width: var.$screen-sm) {
L
LeoKu 已提交
88 89 90 91 92 93 94 95 96 97 98 99 100 101
        width: 90%;
      }

      .avatar-img {
        width: 100%;
        height: 100%;
        object-fit: contain;
      }
    }

    .tip {
      max-width: 70%;
      margin: 0 auto;
      padding: 1.5rem 0;
102
      color: var.$color-text;
L
LeoKu 已提交
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
      font-size: 0.85rem;
      text-align: center;
      cursor: default;
    }
  }

  .close-btn {
    position: absolute;
    right: 1rem;
    bottom: -1rem;
    min-width: 5rem;
    height: 2.5rem;
    margin: 0 1rem;
    margin-left: auto;
    padding: 0 1rem;
118
    color: var.$color-text;
L
LeoKu 已提交
119
    font-weight: bold;
120
    background: var.$color-gray;
L
LeoKu 已提交
121 122 123 124 125 126 127
    border-radius: 0.2rem;
    border-radius: 0.6rem;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    user-select: none;

    &:hover {
128
      color: lighten(var.$color-text, 10);
L
LeoKu 已提交
129 130 131 132 133
      transform: translateY(-0.3rem);
    }
  }
}
</style>