@@ -4,45 +4,81 @@ import leven from 'leven'
4
4
import React , { Component } from 'react'
5
5
6
6
import { SUI } from 'src/lib'
7
- import {
8
- Form ,
9
- Grid ,
10
- Header ,
11
- Icon ,
12
- Message ,
13
- Popup ,
14
- } from 'src'
7
+ import { Form , Grid , Header , Icon , Message , Popup } from 'src'
15
8
16
9
const gridStyle = {
17
10
background : '#fff' ,
18
11
}
19
12
20
13
const iconKeyToHeaderMap = {
21
- WEB_CONTENT_ICONS : 'Web Content' ,
22
- USER_ACTIONS_ICONS : 'User Actions' ,
23
- MESSAGES_ICONS : 'Messages' ,
24
- USERS_ICONS : 'Users' ,
25
- GENDER_SEXUALITY_ICONS : 'Gender & Sexuality' ,
26
- ACCESSIBILITY_ICONS : 'Accessibility' ,
27
- VIEW_ADJUSTMENT_ICONS : 'View Adjustment' ,
28
- LITERAL_OBJECTS_ICONS : 'Literal Objects' ,
29
- SHAPES_ICONS : 'Shapes' ,
30
- ITEM_SELECTION_ICONS : 'Item Selection' ,
31
- MEDIA_ICONS : 'Media' ,
32
- POINTERS_ICONS : 'Pointers' ,
33
- MOBILE_ICONS : 'Mobile' ,
34
- COMPUTER_ICONS : 'Computer' ,
35
- FILE_SYSTEM_ICONS : 'File System' ,
36
- TECHNOLOGIES_ICONS : 'Technologies' ,
37
- RATING_ICONS : 'Rating' ,
38
- AUDIO_ICONS : 'Audio' ,
39
- MAP_LOCATIONS_TRANSPORTATION_ICONS : 'Map, Locations & Transportation' ,
40
- TABLES_ICONS : 'Tables' ,
41
- TEXT_EDITOR_ICONS : 'Text Editor' ,
42
- CURRENCY_ICONS : 'Currency' ,
43
- PAYMENT_OPTIONS_ICONS : 'Payment Options' ,
44
- NETWORKS_AND_WEBSITE_ICONS : 'Networks And Website' ,
45
- ICON_ALIASES : 'Icon Aliases' ,
14
+ ACCESSIBILITY : {
15
+ title : 'Accessibility' ,
16
+ description : 'Icons can represent accessibility standards' ,
17
+ } ,
18
+ ARROWS : { title : 'Arrows' , description : 'Icons can be used to indicate a direction' } ,
19
+ AUDIO_VIDEO : {
20
+ title : 'Audio & Video' ,
21
+ description : 'Icons can be used to represent common ways to interact with audio and video' ,
22
+ } ,
23
+ BUSINESS : {
24
+ title : 'Business' ,
25
+ description : 'Icons can be used to represent business and common business actions' ,
26
+ } ,
27
+ CHESS : { title : 'Chess' , description : 'Icons which represent the game chess' } ,
28
+ CODE : { title : 'Code' , description : 'Icons can represent programming and programming tools' } ,
29
+ COMMUNICATION : {
30
+ title : 'Communication' ,
31
+ description : 'Icons which represent common ways of communication' ,
32
+ } ,
33
+ COMPUTERS : {
34
+ title : 'Computers' ,
35
+ description : 'Icons can represent computing devices, or types of content found on a computer' ,
36
+ } ,
37
+ CURRENCY : { title : 'Currency' , description : 'Icons can represent units of currency' } ,
38
+ DATE_TIME : {
39
+ title : 'Date & Time' ,
40
+ description : 'Icons that represent common ways of showing date and time' ,
41
+ } ,
42
+ DESIGN : {
43
+ title : 'Design' ,
44
+ description : 'Icons can represent common design related symbols or techniques' ,
45
+ } ,
46
+ EDITORS : {
47
+ title : 'Editors' ,
48
+ description : 'Icons can represent text editors and common editor actions' ,
49
+ } ,
50
+ FILES : {
51
+ title : 'Files' ,
52
+ description : 'Icons can represent elements of a computer and its file system' ,
53
+ } ,
54
+ GENDERS : { title : 'Genders' , description : 'Icons can represent genders or types of sexuality' } ,
55
+ HANDS_GESTURES : {
56
+ title : 'Hands & Gestures' ,
57
+ description : 'Icons can represent hand signals and gestures' ,
58
+ } ,
59
+ HEALTH : { title : 'Health' , description : 'Icons which represent common health symbols' } ,
60
+ IMAGES : { title : 'Images' , description : 'Icons that represent common image symbols and actions' } ,
61
+ INTERFACES : {
62
+ title : 'Interfaces' ,
63
+ description : 'Icons can represent common actions a user can take or use' ,
64
+ } ,
65
+ LOGISTICS : { title : 'Logistics' , description : 'Icons can represent common logistic activity' } ,
66
+ MAPS : { title : 'Maps' , description : 'Icons can be used to represent elements on a map' } ,
67
+ MEDICAL : { title : 'Medical' , description : 'Icons can represent common medical actions' } ,
68
+ OBJECTS : { title : 'Objects' , description : 'Icons can be used to represent common objects' } ,
69
+ PAYMENTS_SHOPPING : {
70
+ title : 'Payments & Shopping' ,
71
+ description : 'Icons can represent common forms of payment and shopping actions' ,
72
+ } ,
73
+ SHAPES : { title : 'Shapes' , description : 'Icons can be used to create shapes' } ,
74
+ SPINNERS : { title : 'Spinners' , description : 'Icons can represent loading' } ,
75
+ SPORTS : { title : 'Sports' , description : 'Icons which represent sports' } ,
76
+ STATUS : { title : 'Status' , description : 'Icons can represent different states' } ,
77
+ USERS_PEOPLE : { title : 'Users & People' , description : 'Icons can represent users or people' } ,
78
+ VEHICLES : { title : 'Vehicles' , description : 'Icons can represent vehicles or transport' } ,
79
+ WRITING : { title : 'Writing' , description : 'Icons can represent writing and editing' } ,
80
+ BRANDS : { title : 'Brands' , description : 'Icons can represent logos to common brands' } ,
81
+ ICON_ALIASES : { title : 'Icon Aliases' , description : 'Some of icons have usefull aliases.' } ,
46
82
}
47
83
48
84
const similarityScore = ( strA , strB ) => {
@@ -73,9 +109,9 @@ export default class IconSearch extends Component {
73
109
setTimeout ( ( ) => this . setState ( { copied : false } ) , 1000 )
74
110
}
75
111
76
- renderIconColumn = name => (
112
+ renderIconColumn = ( name , section ) => (
77
113
< Popup
78
- key = { name }
114
+ key = { [ name , section ] . filter ( Boolean ) . join ( '_' ) }
79
115
mouseEnterDelay = { 1000 }
80
116
inverted
81
117
closeOnTriggerClick = { false }
@@ -85,12 +121,12 @@ export default class IconSearch extends Component {
85
121
size = 'mini'
86
122
position = 'top center'
87
123
content = { this . state . copied ? 'Copied!' : 'Click to copy' }
88
- trigger = { (
124
+ trigger = {
89
125
< Grid . Column className = 'docs-icon-set-column' onClick = { this . copy ( name ) } >
90
126
< Icon name = { name } size = 'big' />
91
127
< p className = 'name' > { name } </ p >
92
128
</ Grid . Column >
93
- ) }
129
+ }
94
130
/>
95
131
)
96
132
@@ -104,24 +140,26 @@ export default class IconSearch extends Component {
104
140
return iconKeys . map ( iconKey => (
105
141
< Grid key = { iconKey } columns = { 5 } doubling >
106
142
< Grid . Column width = { 16 } >
107
- < Header as = 'h3' textAlign = 'left' dividing >
108
- { iconKeyToHeaderMap [ iconKey ] }
109
- </ Header >
143
+ < Header
144
+ as = 'h3'
145
+ content = { iconKeyToHeaderMap [ iconKey ] . title }
146
+ dividing
147
+ subheader = { iconKeyToHeaderMap [ iconKey ] . description }
148
+ textAlign = 'left'
149
+ />
110
150
</ Grid . Column >
111
- { SUI [ iconKey ] . map ( this . renderIconColumn ) }
151
+ { SUI [ iconKey ] . map ( name => this . renderIconColumn ( name , iconKey ) ) }
112
152
</ Grid >
113
153
) )
114
154
}
115
155
116
- const iconSearchMatches = SUI . ICONS_AND_ALIASES
117
- . filter ( ( name ) => {
118
- // contains
119
- if ( name . indexOf ( query ) !== - 1 ) return true
156
+ const iconSearchMatches = SUI . ICONS_AND_ALIASES . filter ( ( name ) => {
157
+ // contains
158
+ if ( name . indexOf ( query ) !== - 1 ) return true
120
159
121
- // similar
122
- return includeSimilar && similarityScore ( name , query ) <= 2
123
- } )
124
- . map ( this . renderIconColumn )
160
+ // similar
161
+ return includeSimilar && similarityScore ( name , query ) <= 2
162
+ } ) . map ( name => this . renderIconColumn ( name ) )
125
163
126
164
// no results
127
165
if ( iconSearchMatches . length === 0 ) {
@@ -131,7 +169,9 @@ export default class IconSearch extends Component {
131
169
< Message
132
170
info
133
171
icon = 'search'
134
- content = { `There is no icon name or alias ${ includeSimilar ? 'similar' : 'that contains' } to "${ query } ".` }
172
+ content = { `There is no icon name or alias ${
173
+ includeSimilar ? 'similar' : 'that contains'
174
+ } to "${ query } ".`}
135
175
header = 'No Results'
136
176
/>
137
177
</ Grid . Column >
@@ -140,7 +180,11 @@ export default class IconSearch extends Component {
140
180
}
141
181
142
182
// results
143
- return < Grid columns = { 5 } doubling > { iconSearchMatches } </ Grid >
183
+ return (
184
+ < Grid columns = { 5 } doubling >
185
+ { iconSearchMatches }
186
+ </ Grid >
187
+ )
144
188
}
145
189
146
190
render ( ) {
@@ -151,14 +195,6 @@ export default class IconSearch extends Component {
151
195
< Header as = 'h2' > Icon Set</ Header >
152
196
< p > An icon set contains an arbitrary number of glyphs.</ p >
153
197
154
- < Message >
155
- Semantic includes a complete port of{ ' ' }
156
- < a href = 'http://fontawesome.io/whats-new/' rel = 'noopener noreferrer' target = '_blank' > Font Awesome 4.7.0</ a >
157
- { ' ' } designed by{ ' ' }
158
- < a href = 'http://www.twitter.com/davegandy' rel = 'noopener noreferrer' > Dave Gandy</ a > for its standard icon
159
- set.
160
- </ Message >
161
-
162
198
< Form >
163
199
< Form . Group inline >
164
200
< Form . Input
@@ -169,16 +205,26 @@ export default class IconSearch extends Component {
169
205
/>
170
206
< Form . Checkbox
171
207
toggle
172
- label = 'Show similar'
208
+ label = 'Show similar names '
173
209
checked = { includeSimilar }
174
210
onChange = { this . handleIncludeSimilarChange }
175
211
/>
176
212
</ Form . Group >
177
213
</ Form >
214
+
215
+ < Message >
216
+ Semantic includes a complete port of{ ' ' }
217
+ < a href = 'https://fontawesome.com/' rel = 'noopener noreferrer' target = '_blank' >
218
+ Font Awesome 5.0.8
219
+ </ a > { ' ' }
220
+ designed by the{ ' ' }
221
+ < a href = 'https://twitter.com/fontawesome' rel = 'noopener noreferrer' >
222
+ FontAwesome
223
+ </ a > { ' ' }
224
+ for its standard icon set.
225
+ </ Message >
178
226
</ Grid . Column >
179
- < Grid . Column textAlign = 'center' >
180
- { this . renderIcons ( ) }
181
- </ Grid . Column >
227
+ < Grid . Column textAlign = 'center' > { this . renderIcons ( ) } </ Grid . Column >
182
228
</ Grid >
183
229
)
184
230
}
0 commit comments