zhengyiming
2025-02-13 2aeb3037ac790c84161a4f6745e0ab7157820a2c
1
2
3
4
5
6
7
8
9
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
54
55
56
57
58
59
60
61
62
63
64
<template>
  <div :class="['card-wrapper', { shadow, clickable: isLink }]">
    <slot />
  </div>
</template>
 
<script setup lang="ts">
defineOptions({
  name: 'Card',
});
 
type Props = {
  shadow?: boolean;
  isLink?: boolean;
};
 
withDefaults(defineProps<Props>(), {
  shadow: false,
  isLink: false,
});
</script>
 
<style lang="scss">
@import '@/styles/common.scss';
 
.card-wrapper {
  background: #ffffff;
  overflow: hidden;
  margin-bottom: 24px;
  position: relative;
  border-radius: 8px;
 
  &:last-child {
    margin-bottom: 0;
  }
 
  &.shadow {
    box-shadow: 0px 10px 30px 0px rgba(66, 66, 66, 0.1);
  }
 
  &:active::before {
    opacity: 0.1;
  }
 
  &.clickable {
    cursor: pointer;
 
    &::before {
      position: absolute;
      top: 50%;
      left: 50%;
      width: 100%;
      height: 100%;
      background-color: #000;
      border: inherit;
      border-color: #000;
      border-radius: inherit;
      transform: translate(-50%, -50%);
      opacity: 0;
      content: ' ';
    }
  }
}
</style>