File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -151,3 +151,10 @@ footer a:hover {
151151 text-align : center;
152152 }
153153}
154+
155+ input [type = text ]{
156+ border-radius : 0.5em ;
157+ margin : 0.5em ;
158+ padding : 0.5em ;
159+ border-color : # 2c3e50 ;
160+ }
Original file line number Diff line number Diff line change 55
66<main >
77 <h1 >Available Font-Awesome v4 Icons</h1 >
8-
8+ < input type = "text" name = "search" placeholder = "Search Icon" on:input ={( e ) => debounce ( e . currentTarget . value )}>
99 <table >
1010 <thead >
1111 <tr >
1515 <th >Example Snippet</th >
1616 </tr >
1717 </thead >
18- {#each data as icon }
18+ {#each filteredIcons as icon }
1919 <tr >
2020 <td ><Icon data ={getIcon (icon .fileName )} scale ={5 } /></td >
2121 <td >{icon .fileName }</td >
5252 function getIcon(name : string ): IconType {
5353 return (icons as Record <string , IconType >)[name ];
5454 }
55+
56+ let searchValue = ' ' ;
57+ let timer : number ;
58+ const debounce = (v : string ) => {
59+ clearTimeout (timer );
60+ timer = setTimeout (() => {
61+ searchValue = v ;
62+ }, 750 );
63+ }
64+
65+ $ : filteredIcons = data .filter (icon => icon .iconName .toLowerCase ().startsWith (searchValue ))
5566 </script >
You can’t perform that action at this time.
0 commit comments