DownloadModal.vue 2.5 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 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
          <img
            alt="vue-color-avatar"
            :src="props.imageUrl"
            class="avatar-img"
          />
        </div>

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

      <button class="close-btn" @click="emit('close')">
        {{ 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>
.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;
  background-color: rgba($color-dark, 0.4);
  transform: translate(-50%, 0);
L
LeoKu 已提交
54
  backdrop-filter: blur(0.3rem);
L
LeoKu 已提交
55 56 57 58 59 60 61 62
}

.download-modal {
  position: relative;
  width: 50%;
  min-width: 310px;
  max-width: 500px;
  background-color: darken($color-dark, 1);
L
LeoKu 已提交
63
  border: 0.15rem solid rgba($color-accent, 0.8);
L
LeoKu 已提交
64 65 66 67 68 69 70 71 72 73
  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 已提交
74
    .avatar-preview {
L
LeoKu 已提交
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
      width: 60%;
      margin: 0 auto;

      @media screen and (max-width: $screen-md) {
        width: 80%;
      }

      @media screen and (max-width: $screen-sm) {
        width: 90%;
      }

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

    .tip {
      max-width: 70%;
      margin: 0 auto;
      padding: 1.5rem 0;
      color: $color-text;
      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;
    color: $color-text;
    font-weight: bold;
    background: $color-gray;
    border-radius: 0.2rem;
    border-radius: 0.6rem;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    user-select: none;

    &:hover {
      color: lighten($color-text, 10);
      transform: translateY(-0.3rem);
    }
  }
}
</style>