@@ -2,9 +2,18 @@ import LogosLight from "../Logos/LogosLight";
2
2
import { FlagList } from "../icons/Flags" ;
3
3
import { PaymentList } from "../icons/Payments" ;
4
4
import { Icon } from "./Icon" ;
5
+ import { IconName } from "../types" ;
5
6
import { ICONS_MAP } from "./IconCommon" ;
6
7
import { IconProps } from "./types" ;
7
8
import { Container } from "../Container/Container" ;
9
+ import { styled } from "styled-components" ;
10
+ import { useState } from "react" ;
11
+ import { SearchField } from "../Input/SearchField" ;
12
+ import { Title } from "../Typography/Title/Title" ;
13
+ import { Panel } from "../Panel/Panel" ;
14
+ import { Text } from "../Typography/Text/Text" ;
15
+ import { GridContainer } from "../GridContainer/GridContainer" ;
16
+ import { Spacer } from "../Spacer/Spacer" ;
8
17
9
18
const IconNames = Object . keys ( ICONS_MAP ) ;
10
19
const FlagNames = Object . keys ( FlagList ) ;
@@ -46,3 +55,138 @@ export const Playground = {
46
55
height : "" ,
47
56
} ,
48
57
} ;
58
+
59
+ type IconGalleryProps = {
60
+ name : IconName ;
61
+ } ;
62
+
63
+ const IconGallery = ( { name } : IconGalleryProps ) => (
64
+ < Container gap = "xs" >
65
+ < Panel
66
+ hasBorder
67
+ padding = "xs"
68
+ >
69
+ < Icon
70
+ name = { name }
71
+ size = "md"
72
+ />
73
+ </ Panel >
74
+ < Text
75
+ size = "sm"
76
+ color = "muted"
77
+ >
78
+ { name }
79
+ </ Text >
80
+ </ Container >
81
+ ) ;
82
+
83
+ const ResponsiveGridContainer = styled ( GridContainer ) `
84
+ grid-template-columns: repeat(6, 1fr);
85
+ gap: 1em;
86
+
87
+ @media (max-width: 1400px) {
88
+ grid-template-columns: repeat(4, 1fr);
89
+ }
90
+ @media (max-width: 1100px) {
91
+ grid-template-columns: repeat(3, 1fr);
92
+ }
93
+ @media (max-width: 800px) {
94
+ grid-template-columns: repeat(2, 1fr);
95
+ }
96
+ @media (max-width: 500px) {
97
+ grid-template-columns: 1fr;
98
+ }
99
+ ` ;
100
+
101
+ export const Icons = ( ) => {
102
+ const [ query , setQuery ] = useState ( "" ) ;
103
+ return (
104
+ < Container
105
+ orientation = "vertical"
106
+ gap = "sm"
107
+ maxWidth = "1000px"
108
+ style = { { margin : "0 auto" } }
109
+ >
110
+ < Title type = "h2" > Glyph</ Title >
111
+
112
+ < Container
113
+ orientation = "vertical"
114
+ gap = "md"
115
+ >
116
+ < SearchField
117
+ value = { query }
118
+ placeholder = "Search icons..."
119
+ onChange = { setQuery }
120
+ tabIndex = { 1 }
121
+ />
122
+ < ResponsiveGridContainer >
123
+ { Object . keys ( ICONS_MAP )
124
+ . filter (
125
+ key => query === "" || key . toLowerCase ( ) . includes ( query . toLowerCase ( ) )
126
+ )
127
+ . sort ( )
128
+ . map ( key => {
129
+ return (
130
+ < IconGallery
131
+ key = { key }
132
+ name = { key as IconName }
133
+ />
134
+ ) ;
135
+ } ) }
136
+ </ ResponsiveGridContainer >
137
+ </ Container >
138
+
139
+ < Spacer size = "md" />
140
+
141
+ < Title type = "h2" > Flags</ Title >
142
+
143
+ < ResponsiveGridContainer >
144
+ { Object . keys ( FlagList ) . map ( key => (
145
+ < IconGallery
146
+ key = { key }
147
+ name = { key as IconName }
148
+ />
149
+ ) ) }
150
+ </ ResponsiveGridContainer >
151
+
152
+ < Spacer size = "md" />
153
+
154
+ < Title type = "h2" > Payments</ Title >
155
+
156
+ < ResponsiveGridContainer >
157
+ { Object . keys ( PaymentList ) . map ( key => (
158
+ < IconGallery
159
+ key = { key }
160
+ name = { key as IconName }
161
+ />
162
+ ) ) }
163
+ </ ResponsiveGridContainer >
164
+
165
+ < Spacer size = "md" />
166
+
167
+ < Title type = "h2" > Payments</ Title >
168
+
169
+ < ResponsiveGridContainer >
170
+ { Object . keys ( PaymentList ) . map ( key => (
171
+ < IconGallery
172
+ key = { key }
173
+ name = { key as IconName }
174
+ />
175
+ ) ) }
176
+ </ ResponsiveGridContainer >
177
+
178
+ < Spacer size = "md" />
179
+
180
+ < Title type = "h2" > Logo</ Title >
181
+
182
+ < ResponsiveGridContainer >
183
+ { Object . keys ( LogosLight ) . map ( key => (
184
+ < IconGallery
185
+ key = { key }
186
+ name = { key as IconName }
187
+ />
188
+ ) ) }
189
+ </ ResponsiveGridContainer >
190
+ </ Container >
191
+ ) ;
192
+ } ;
0 commit comments