docs/.vitepress/theme/components/ChristmasCard.vue

d9d65a740541b29d4e0fe02eb4dfde348d54d5ae
wotaku/docs/.vitepress/theme/components/ChristmasCard.vue history · blame · raw

318 lines · 6722 bytes

  1<!--
  2  All Rights Reserved
  3
  4  Copyright (c) 2025 taskylizard
  5
  6  All rights reserved. This code and its associated files may not be copied, modified, distributed, sublicensed, or used in any form, in whole or in part, without prior written permission from the copyright holder.
  7-->
  8<script setup lang="ts">
  9import { ref } from 'vue'
 10
 11const clickIcon = ref<HTMLSpanElement>()
 12const card = ref<HTMLDivElement>()
 13
 14const handleClick = () => {
 15  card.value?.classList.toggle('is-opened')
 16  clickIcon.value?.classList.toggle('is-hidden')
 17}
 18</script>
 19
 20<template>
 21  <div class="h-xl" />
 22  <div class="card" ref="card" :onClick="handleClick">
 23    <div class="card-page cart-page-front">
 24      <div class="card-page cart-page-outside"></div>
 25      <div class="card-page cart-page-inside"></div>
 26    </div>
 27    <div class="card-page cart-page-bottom">
 28      <p class="card-text">Merry Christmas from the Wotaku team!</p>
 29    </div>
 30  </div>
 31  <span class="click-icon" ref="clickIcon">
 32    <svg viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">
 33      <path
 34        fill="#fff"
 35        d="M31.6 17.7V26c0 1.9-.7 3.7-2 5.1v.9c0 1.6-1.3 3-3 3h-8.4c-1.6 0-3-1.3-3-3 0-.6.5-1 1-1s1 .4 1 1c0 .5.4 1 1 1h8.4c.5 0 1-.4 1-1v-1.2-.3-.1c0-.1.1-.2.2-.3 1.1-1.1 1.7-2.5 1.7-4v-8.3c0-.3-.1-.5-.3-.7-.1-.1-.5-.4-1-.3-.4.1-.8.6-.8 1.1v2.4c0 .6-.5 1-1 1s-1-.4-1-1v-5.5c0-.3-.1-.5-.3-.7s-.4-.3-.7-.3c-.5 0-1 .5-1 1v5.5c0 .6-.5 1-1 1s-1-.4-1-1v-8.5c0-.3-.1-.5-.3-.7s-.4-.3-.7-.3c-.5 0-1 .5-1 1v8.5c0 .6-.5 1-1 1s-1-.4-1-1V7.7c0-.3-.1-.5-.3-.7-.1-.1-.5-.4-1-.3-.4.1-.8.6-.8 1.1V20c0 .4-.2.8-.6.9-.4.2-.8.1-1.1-.2L11 18.1c-.6-.6-1.6-.6-2.2.1-.5.6-.4 1.5.2 2.1l7 7c.4.4.4 1 0 1.4-.2.2-.5.3-.7.3-.3 0-.5-.1-.7-.3l-7-7.1c-1.3-1.3-1.5-3.5-.3-4.8C8 16 9 15.5 10 15.5c.9 0 1.8.4 2.5 1l.9.9V7.9c0-1.4.9-2.7 2.3-3 1-.3 2.1 0 2.8.8.6.6.9 1.3.9 2.1V9c.3-.1.7-.2 1-.2.8 0 1.5.3 2.1.9s.9 1.3.9 2.1v.2c.3-.1.7-.2 1-.2.8 0 1.5.3 2.1.9s.9 1.3.9 2.1v.2c.1 0 .2-.1.3-.1 1-.3 2.1 0 2.8.8.8.5 1.1 1.3 1.1 2z"
 36      />
 37    </svg>
 38  </span>
 39</template>
 40
 41<style scoped>
 42.card {
 43  perspective: 1500px;
 44  position: absolute;
 45  left: calc(50% - 175px);
 46  top: calc(50% - 250px);
 47  transition-property: transform;
 48  transition-duration: 1s;
 49  transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55);
 50  transition-delay: initial;
 51  transform: rotate(-10deg) translate(0, 0);
 52  -webkit-animation: cardIn 1s alternate cubic-bezier(0.87, -0.41, 0.19, 1.44);
 53  animation: cardIn 1s alternate cubic-bezier(0.87, -0.41, 0.19, 1.44);
 54}
 55
 56@media (max-width: 767px) {
 57  .card {
 58    left: calc(50% - 115px);
 59    top: calc(50% - 164.5px);
 60  }
 61}
 62
 63@media (max-width: 479px) {
 64  .card {
 65    left: calc(50% - 75px);
 66    top: calc(50% - 107px);
 67  }
 68}
 69
 70.card:before {
 71  content: "";
 72  display: block;
 73  position: absolute;
 74  left: 0;
 75  top: 0;
 76  width: 100%;
 77  height: 100%;
 78  box-shadow: 0 0 50px #000;
 79  transition: all 0.5s ease-in-out;
 80}
 81
 82.card.is-opened {
 83  transform: rotate(0deg) translate(175px, 0);
 84}
 85
 86@media (max-width: 767px) {
 87  .card.is-opened {
 88    transform: rotate(0deg) translate(115px, 0);
 89  }
 90}
 91
 92@media (max-width: 479px) {
 93  .card.is-opened {
 94    transform: rotate(0deg) translate(75px, 0);
 95  }
 96}
 97
 98.card.is-opened .cart-page-front {
 99  transform: rotateY(-180deg);
100}
101
102@-webkit-keyframes cardIn {
103  0% {
104    opacity: 0;
105    transform: rotate(-10deg) translate(0, -100%);
106  }
107
108  25% {
109    opacity: 1;
110  }
111
112  100% {
113    opacity: 1;
114    transform: rotate(-10deg) translate(0, 0);
115  }
116}
117
118@keyframes cardIn {
119  0% {
120    opacity: 0;
121    transform: rotate(-10deg) translate(0, -100%);
122  }
123
124  25% {
125    opacity: 1;
126  }
127
128  100% {
129    opacity: 1;
130    transform: rotate(-10deg) translate(0, 0);
131  }
132}
133
134.card,
135.card-page {
136  width: 350px;
137  height: 500px;
138}
139
140@media (max-width: 767px) {
141  .card,
142  .card-page {
143    width: 230px;
144    height: 329px;
145  }
146}
147
148@media (max-width: 479px) {
149  .card,
150  .card-page {
151    width: 150px;
152    height: 214px;
153  }
154}
155
156.card-page {
157  transition: transform 1s ease-in-out;
158  cursor: pointer;
159  position: absolute;
160  outline: 1px solid transparent;
161}
162
163.cart-page-front {
164  transform-origin: 0 50% 0;
165  transform-style: preserve-3d;
166  transform: rotateY(-20deg);
167  z-index: 2;
168}
169
170.cart-page-outside,
171.cart-page-inside {
172  position: absolute;
173  -webkit-backface-visibility: hidden;
174  backface-visibility: hidden;
175}
176
177.cart-page-outside {
178  border: 10px solid #fbfbfb;
179  background: #c72320 url("/christmas/front.png") no-repeat center;
180  background-size: cover;
181  width: 100%;
182  height: 100%;
183}
184
185@media (max-width: 767px) {
186  .cart-page-outside {
187    border: 5px solid #fbfbfb;
188  }
189}
190
191.cart-page-inside {
192  background: #c72320 url("/christmas/out.jpg") no-repeat center;
193  background-size: cover;
194  width: 100%;
195  height: 100%;
196}
197
198.cart-page-bottom {
199  background-color: #d4d1d0;
200  background-image: url("/christmas/pattern.png");
201  border: 20px solid #d4d1d0;
202  display: -webkit-box;
203  display: -moz-box;
204  display: box;
205  display: -moz-flex;
206  display: flex;
207  box-pack: center;
208  -moz-justify-content: center;
209  -ms-justify-content: center;
210  -o-justify-content: center;
211  justify-content: center;
212  -ms-flex-pack: center;
213  box-align: center;
214  -moz-align-items: center;
215  -ms-align-items: center;
216  -o-align-items: center;
217  align-items: center;
218  -ms-flex-align: center;
219  text-align: center;
220}
221
222@media (max-width: 767px) {
223  .cart-page-bottom {
224    border: 10px solid #d4d1d0;
225  }
226}
227
228.cart-page-bottom {
229  z-index: 1;
230  border-left: none !important;
231  background-position: -22px 80px;
232}
233
234@media (max-width: 767px) {
235  .cart-page-bottom {
236    background-position: 85px 30px;
237  }
238}
239
240@media (max-width: 479px) {
241  .cart-page-bottom {
242    background-position: 0px 30px;
243  }
244}
245
246.click-icon {
247  position: absolute;
248  left: 50%;
249  transform: translate(-50%, 0);
250  bottom: 20px;
251  -webkit-animation: iconAnimation 1s infinite alternate ease-in-out;
252  animation: iconAnimation 1s infinite alternate ease-in-out;
253  transition: opacity 0.5s ease-in-out;
254  opacity: 1;
255}
256
257.click-icon svg {
258  width: 96px;
259  height: 96px;
260}
261
262@media (max-width: 767px) {
263  .click-icon svg {
264    width: 72px;
265    height: 72px;
266  }
267}
268
269@media (max-width: 479px) {
270  .click-icon svg {
271    width: 48px;
272    height: 48px;
273  }
274}
275
276.click-icon.is-hidden {
277  opacity: 0;
278}
279
280@-webkit-keyframes iconAnimation {
281  0% {
282    transform: translate(-50%, 0);
283  }
284
285  100% {
286    transform: translate(-50%, 10px);
287  }
288}
289
290@keyframes iconAnimation {
291  0% {
292    transform: translate(-50%, 0);
293  }
294
295  100% {
296    transform: translate(-50%, 10px);
297  }
298}
299
300.card-text {
301  color: #3c3c43;
302  font-size: 36px;
303  line-height: 1.2em;
304  padding-left: 10px;
305}
306
307@media (max-width: 767px) {
308  .card-text {
309    font-size: 24px;
310  }
311}
312
313@media (max-width: 479px) {
314  .card-text {
315    font-size: 20px;
316  }
317}
318</style>