-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
106 lines (102 loc) · 1.9 KB
/
index.js
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
import { query } from '@pluginjs/dom'
import SvgPicker from '@pluginjs/svg-picker'
import feather from 'feather-icons'
// see https://github.com/feathericons/feather
const icons = {
Arrows: [
'arrow-down-circle',
'arrow-down-left',
'arrow-down-right',
'arrow-down',
'arrow-left-circle',
'arrow-left',
'arrow-right-circle',
'arrow-right',
'arrow-up-circle',
'arrow-up-left',
'arrow-up-right',
'arrow-up',
'chevron-down',
'chevron-left',
'chevron-right',
'chevron-up',
'chevrons-down',
'chevrons-left',
'chevrons-right',
'chevrons-up',
'corner-down-left',
'corner-down-right',
'corner-left-down',
'corner-left-up',
'corner-right-down',
'corner-right-up',
'corner-up-left',
'corner-up-right'
],
Devices: [
'camera',
'hard-drive',
'mic',
'monitor',
'phone',
'printer',
'radio',
'server',
'smartphone',
'speaker',
'tablet',
'tv',
'video',
'watch'
],
Social: [
'chrome',
'codepen',
'facebook',
'github',
'gitlab',
'instagram',
'linkedin',
'pocket',
'slack',
'twitter',
'youtube'
],
Weather: [
'cloud-drizzle',
'cloud-lightning',
'cloud-off',
'cloud-rain',
'cloud-snow',
'cloud',
'droplet',
'sun',
'sunrise',
'sunset',
'wind'
]
}
const element = query('#group .example')
SvgPicker.of(element, {
source(resolve) {
const source = []
Object.keys(icons).forEach(category => {
const group = {
name: category,
children: []
}
icons[category].forEach(icon => {
const ficon = feather.icons[icon]
group.children.push({
name: ficon.name,
category,
tags: ficon.tags,
svg: ficon.toSvg()
})
})
source.push(group)
})
console.info(source)
resolve(source)
}
})