1
+ import TextField from "@mui/material/TextField" ;
2
+ import InputAdornment from "@mui/material/InputAdornment" ;
3
+ import Tooltip from "@mui/material/Tooltip" ;
4
+ import IconButton from "@mui/material/IconButton" ;
5
+ import SearchIcon from "@mui/icons-material/SearchOutlined" ;
6
+ import ClearIcon from "@mui/icons-material/CloseOutlined" ;
7
+ import { useTheme } from "@emotion/react" ;
1
8
import { type ReactNode , useMemo , useState } from "react" ;
2
9
import uFuzzy from "ufuzzy" ;
3
10
import { CopyableValue } from "components/CopyableValue/CopyableValue" ;
4
11
import { Margins } from "components/Margins/Margins" ;
12
+ import { PageHeader , PageHeaderTitle } from "components/PageHeader/PageHeader" ;
5
13
import { Stack } from "components/Stack/Stack" ;
6
- import { colors } from "theme/colors" ;
7
14
import icons from "theme/icons.json" ;
8
15
9
16
const iconsWithoutSuffix = icons . map ( ( icon ) => icon . split ( "." ) [ 0 ] ) ;
@@ -16,6 +23,7 @@ const fuzzyFinder = new uFuzzy({
16
23
} ) ;
17
24
18
25
export default function ( ) {
26
+ const theme = useTheme ( ) ;
19
27
const [ searchText , setSearchText ] = useState ( "" ) ;
20
28
21
29
const searchedIcons = useMemo ( ( ) => {
@@ -53,32 +61,74 @@ export default function () {
53
61
54
62
return (
55
63
< Margins >
56
- < input
57
- type = "search"
58
- onChange = { ( event ) => setSearchText ( event . target . value ) }
64
+ < PageHeader >
65
+ < PageHeaderTitle > Icons</ PageHeaderTitle >
66
+ </ PageHeader >
67
+ < TextField
68
+ size = "small"
69
+ InputProps = { {
70
+ "aria-label" : "Filter" ,
71
+ name : "query" ,
72
+ placeholder : "Search..." ,
73
+ value : searchText ,
74
+ onChange : ( e ) => {
75
+ setSearchText ( e . target . value ) ;
76
+ } ,
77
+ sx : {
78
+ borderRadius : "6px" ,
79
+ marginLeft : "-1px" ,
80
+ "& input::placeholder" : {
81
+ color : theme . palette . text . secondary ,
82
+ } ,
83
+ "& .MuiInputAdornment-root" : {
84
+ marginLeft : 0 ,
85
+ } ,
86
+ } ,
87
+ startAdornment : (
88
+ < InputAdornment position = "start" >
89
+ < SearchIcon
90
+ sx = { {
91
+ fontSize : 14 ,
92
+ color : theme . palette . text . secondary ,
93
+ } }
94
+ />
95
+ </ InputAdornment >
96
+ ) ,
97
+ endAdornment : searchText && (
98
+ < InputAdornment position = "end" >
99
+ < Tooltip title = "Clear filter" >
100
+ < IconButton size = "small" onClick = { ( ) => setSearchText ( "" ) } >
101
+ < ClearIcon sx = { { fontSize : 14 } } />
102
+ </ IconButton >
103
+ </ Tooltip >
104
+ </ InputAdornment >
105
+ ) ,
106
+ } }
59
107
/>
60
- < Stack direction = "row" wrap = "wrap" spacing = { 1 } justifyContent = "center" >
108
+
109
+ < Stack
110
+ direction = "row"
111
+ wrap = "wrap"
112
+ spacing = { 1 }
113
+ justifyContent = "center"
114
+ css = { ( theme ) => ( { marginTop : theme . spacing ( 4 ) } ) }
115
+ >
61
116
{ searchedIcons . map ( ( icon ) => (
62
117
< CopyableValue key = { icon . url } value = { icon . url } placement = "bottom" >
63
- < Stack
64
- alignItems = "center"
65
- css = { ( theme ) => ( { margin : theme . spacing ( 1.5 ) } ) }
66
- >
118
+ < Stack alignItems = "center" css = { { margin : theme . spacing ( 1.5 ) } } >
67
119
< img
68
120
src = { icon . url }
69
121
css = { {
70
- width : 64 ,
71
- height : 64 ,
122
+ width : 60 ,
123
+ height : 60 ,
72
124
objectFit : "contain" ,
73
125
pointerEvents : "none" ,
74
- backgroundColor : colors . gray [ 14 ] ,
75
- borderRadius : 8 ,
76
- padding : 8 ,
126
+ padding : theme . spacing ( 1.5 ) ,
77
127
} }
78
128
/>
79
129
< p
80
130
css = { {
81
- width : 96 ,
131
+ width : 72 ,
82
132
fontSize : 13 ,
83
133
textOverflow : "ellipsis" ,
84
134
textAlign : "center" ,
0 commit comments