-
Notifications
You must be signed in to change notification settings - Fork 151
Expand file tree
/
Copy pathIconGrid.vue
More file actions
103 lines (94 loc) · 1.82 KB
/
IconGrid.vue
File metadata and controls
103 lines (94 loc) · 1.82 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
<script setup>
import IconGridRow from './IconGridRow.vue';
import DropIcon from '@harbour-enterprises/common/icons/droplet-slash.svg?raw';
const emit = defineEmits(['select', 'clickoutside']);
const props = defineProps({
icons: {
type: Array,
required: true,
},
customIcons: {
type: Array,
required: false,
},
activeColor: {
type: Object,
required: false,
},
hasNoneIcon: {
type: Boolean,
required: false,
}
});
const handleSelect = (option) => {
emit('select', option);
};
</script>
<template>
<div class="options-grid-wrap">
<div
v-if="hasNoneIcon"
class="none-option"
role="menuitem"
aria-label="Clear color selection"
@click="handleSelect('none')"
>
<span
v-html="DropIcon"
class="none-icon"
></span>
None
</div>
<div class="option-grid-ctn">
<IconGridRow
:icons="icons"
:active-color="activeColor"
@select="handleSelect"
/>
<template v-if="customIcons.flat().length">
<span class="option-grid-ctn__subtitle">Custom colors</span>
<IconGridRow
:icons="customIcons"
:active-color="activeColor"
@select="handleSelect"
/>
</template>
</div>
</div>
</template>
<style scoped>
.options-grid-wrap {
padding: 5px;
border-radius: 5px;
}
.none-option {
display: flex;
align-items: center;
gap: 4px;
padding: 4px;
&:hover {
opacity: 0.65;
}
}
.none-icon {
width: 16px;
}
.option-grid-ctn {
display: flex;
flex-direction: column;
background-color: #fff;
z-index: 3;
box-sizing: border-box;
&__subtitle {
padding: 3px;
font-size: 12px;
font-weight: 600;
}
}
.option-grid-ctn :deep(svg) {
width: 100%;
height: 100%;
display: block;
fill: currentColor;
}
</style>