|
| 1 | +<script setup lang="ts"> |
| 2 | +import sponsorData from './sponsors.json' |
| 3 | +</script> |
| 4 | + |
| 5 | +<template> |
| 6 | + <div class="sponsor-container"> |
| 7 | + <a |
| 8 | + v-for="{ url, img, name, description } in sponsorData" |
| 9 | + class="sponsor-item" |
| 10 | + :href="url" |
| 11 | + target="_blank" |
| 12 | + rel="sponsored noopener" |
| 13 | + > |
| 14 | + <div class="sponsor-item-img"> |
| 15 | + <img :src="img" :alt="name" /> |
| 16 | + </div> |
| 17 | + <div class="sponsor-item-description">🎁{{ description }}</div> |
| 18 | + </a> |
| 19 | + |
| 20 | + <a href="/sponsor/" class="sponsor-item-action">成为赞助商</a> |
| 21 | + </div> |
| 22 | +</template> |
| 23 | + |
| 24 | +<style scoped> |
| 25 | +.sponsor-container { |
| 26 | + --max-width: 100%; |
| 27 | + display: grid; |
| 28 | + grid-template-columns: repeat(auto-fill, minmax(var(--max-width), 1fr)); |
| 29 | + column-gap: 4px; |
| 30 | +} |
| 31 | +
|
| 32 | +.sponsor-item { |
| 33 | + margin: 2px 0; |
| 34 | + padding: 10px 6px; |
| 35 | + display: block; |
| 36 | + border-radius: 2px; |
| 37 | + color: rgba(60, 60, 60, 0.5); |
| 38 | + background-color: #f6f6f6; |
| 39 | +} |
| 40 | +
|
| 41 | +.sponsor-item-img { |
| 42 | + display: flex; |
| 43 | + justify-content: space-around; |
| 44 | + align-items: center; |
| 45 | +} |
| 46 | +
|
| 47 | +.sponsor-item img { |
| 48 | + max-width: calc(var(--max-width) - 30px); |
| 49 | + max-height: calc(var(--max-width) / 2 - 20px); |
| 50 | +} |
| 51 | +.sponsor-item-description { |
| 52 | + text-align: center; |
| 53 | + font-size: 13px; |
| 54 | + color: rgb(74, 74, 74); |
| 55 | +} |
| 56 | +
|
| 57 | +.sponsor-item-action { |
| 58 | + margin: 2px 0; |
| 59 | + display: flex; |
| 60 | + justify-content: space-around; |
| 61 | + align-items: center; |
| 62 | + border-radius: 2px; |
| 63 | + height: 30px; |
| 64 | + font-size: 11px; |
| 65 | + color: rgba(60, 60, 60, 0.5); |
| 66 | + background-color: #f6f6f6; |
| 67 | +} |
| 68 | +
|
| 69 | +/* dark mode */ |
| 70 | +.dark .aside .sponsor-item { |
| 71 | + background-color: var(--vt-c-bg-soft); |
| 72 | +} |
| 73 | +.aside .sponsor-item img { |
| 74 | + transition: filter 0.2s ease; |
| 75 | +} |
| 76 | +.dark .aside .sponsor-item img { |
| 77 | + filter: grayscale(1) invert(1); |
| 78 | +} |
| 79 | +.dark .aside .sponsor-item:hover { |
| 80 | + color: var(--vt-c-indigo); |
| 81 | + background-color: var(--vt-c-white-mute); |
| 82 | +} |
| 83 | +.dark .sponsor-item:hover img { |
| 84 | + filter: none; |
| 85 | +} |
| 86 | +</style> |
0 commit comments