-
Notifications
You must be signed in to change notification settings - Fork 313
Expand file tree
/
Copy pathShadowLayer.vue
More file actions
137 lines (134 loc) · 2.93 KB
/
ShadowLayer.vue
File metadata and controls
137 lines (134 loc) · 2.93 KB
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
65
66
67
68
69
70
71
72
73
74
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
129
130
131
132
133
134
135
136
137
<template>
<div class="shadow-layer">
<div class="shadow-layer__header">
<div class="shadow-layer__header--name">{{ detail.key }}</div>
<add-icon class="shadow-layer__add" @click="handleAdd" />
</div>
<shadow-editor
class="shadow-layer__edit"
v-for="(data, i) in shadow"
:key="i"
:name="`layer${i + 1}`"
:value="data"
@change="(value) => change(value, i)"
@move="() => handleMove(i)"
>
</shadow-editor>
</div>
</template>
<script lang="jsx">
import { AddIcon } from 'tdesign-icons-vue';
import ShadowEditor from './ShadowEditor.vue';
export default {
name: 'ShadowLayer',
props: {
shadow: Array,
detail: Object,
},
components: {
AddIcon,
ShadowEditor,
},
methods: {
change(value, index) {
const val = [...this.shadow];
val[index] = value;
this.$emit('change', val);
},
handleAdd() {
const val = [...this.shadow];
val.push('0, 0, 0, 0, rgba(0, 0, 0, 0)');
this.$emit('change', val);
},
handleMove(index) {
const val = [...this.shadow];
val.splice(index, 1);
this.$emit('change', val);
},
},
};
</script>
<style scoped lang="less">
.shadow-layer {
display: flex;
flex-direction: column;
max-height: 70vh;
overflow: auto;
&::-webkit-scrollbar {
width: 12px;
background: transparent;
}
&::-webkit-scrollbar-thumb {
border-radius: 6px;
border: 4px solid transparent;
background-clip: content-box;
background-color: transparent;
}
&__header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 4px;
&--name {
font-size: 14px;
color: var(--text-primary);
font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
}
}
&__add {
margin-right: 8px;
color: var(--text-primary);
cursor: pointer;
}
&__card {
padding: 8px;
width: 208px;
background: var(--bg-color-theme-secondary);
border-radius: 6px;
&--item {
display: flex;
margin-bottom: 8px;
&:last-child {
margin-bottom: 0;
}
}
&--x {
width: 60px;
margin-right: 8px;
&:last-child {
margin-right: 0;
}
}
&--sharp {
width: 24px;
height: 24px;
border: 1px solid var(--bg-color-demo-select);
border-radius: 3px;
}
&--color {
margin-left: 4px;
font-size: 14px;
line-height: 22px;
color: var(--text-primary);
}
}
&__title {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 4px;
}
&__name {
font-size: 12px;
color: var(--text-primary);
font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
}
&__suffix {
font-size: 14px;
color: var(--text-placeholder);
}
&__edit {
margin-bottom: 8px;
}
}
</style>