@@ -6,26 +6,33 @@ import { FiExternalLink } from 'react-icons/fi';
66import Footer from "../components/Footer" ;
77import Header from "../components/Header" ;
88import Sidebar from "../components/Sidebar" ;
9- import { Card } from "../components/Card" ;
9+ import { Card } from "../components/Card" ;
1010import { IconsData } from 'github-automated-repos/index' ;
11+ import Loader from '../components/Loader' ;
1112
1213
13- export default function IconStacks ( ) {
14+ export default function IconStacks ( ) {
1415
1516 useEffect ( ( ) => {
1617 window . scrollTo ( 0 , 0 ) ;
17-
18-
19- } , [ ] ) ;
18+ const id = setTimeout ( ( ) => {
19+ setFinishedTimeout ( true ) ;
20+ } , 350 ) ;
21+
22+ return ( ) => clearTimeout ( id ) ;
23+
24+ } , [ ] ) ;
2025 const { iconStacks } = IconsData ( ) ;
21-
26+
27+ const [ finishedTimeout , setFinishedTimeout ] = useState ( false ) ;
28+
2229 const [ stackIconKeys , setStackIconKeys ] = useState ( [ ] ) ;
2330 const [ stackIconValues , setStackIconValues ] = useState ( [ ] ) ;
2431
2532 const [ inicialStackIconKeys , setInicialStackIconKeys ] = useState ( [ ] ) ;
2633 const [ inicialStackIconValues , setInicialStackIconValues ] = useState ( [ ] ) ;
2734 useEffect ( ( ) => {
28-
35+
2936
3037 setStackIconKeys ( Object . keys ( iconStacks ) ) ;
3138 setStackIconValues ( Object . values ( iconStacks ) ) ;
@@ -47,7 +54,7 @@ export default function IconStacks(){
4754 setStackIconKeys ( filterStackIconKeys ) ;
4855 console . log ( filterStackIconKeys ) ;
4956
50- const filterStackIconValues = filterStackIconKeys . map ( ( iconKey ) => {
57+ const filterStackIconValues = filterStackIconKeys . map ( ( iconKey ) => {
5158 return iconStacks [ iconKey ] ;
5259 } ) ;
5360
@@ -69,21 +76,30 @@ export default function IconStacks(){
6976 < input className = ' bg-[#70708e33] w-full rounded-lg px-4 py-2 ' placeholder = '🔍 Search Icons' type = 'text' onChange = { _handleSearch } />
7077 </ div >
7178 < ul className = 'mt-8 flex flex-wrap gap-4 justify-center' >
72- { stackIconValues . length > 0 ? (
73- stackIconValues . map ( ( item , index ) => {
74- return < Card key = { index } item = { item } iconKey = { stackIconKeys [ index ] } /> ;
75- } )
76- ) : (
77- < div className = 'flex flex-col m-auto gap-4' >
78- < p className = 'text-xl text-center' >
79- Didn't find your icon? < br /> Tell us about here:{ ' ' }
80- < a className = 'flex gap-2 text-[#00979C] justify-center' href = 'https://github.com/DIGOARTHUR/github-automated-repos/issues/new?assignees=& labels = & template = 2 - feature - request . yaml ' >
81- Feature Request < FiExternalLink />
82- </ a >
83- </ p >
84- < img className = 'h-[350px]' src = 'https://user-images.githubusercontent.com/59892368/220364871-f553109d-855f-426a-bbe5-5e1c11278003.svg' > </ img >
85- </ div >
86- ) }
79+
80+
81+ {
82+
83+ finishedTimeout == false ? ( < Loader /> ) : (
84+ stackIconValues . length > 0 ? (
85+ stackIconValues . map ( ( item , index ) => {
86+ return < Card key = { index } item = { item } iconKey = { stackIconKeys [ index ] } /> ;
87+ } )
88+ ) : (
89+ < div className = 'flex flex-col m-auto gap-4' >
90+ < p className = 'text-xl text-center' >
91+ Didn't find your icon? < br /> Tell us about here:{ ' ' }
92+ < a className = 'flex gap-2 text-[#00979C] justify-center' href = 'https://github.com/DIGOARTHUR/github-automated-repos/issues/new?assignees=& labels = & template = 2 - feature - request . yaml ' >
93+ Feature Request < FiExternalLink />
94+ </ a >
95+ </ p >
96+ < img className = 'h-[350px]' src = 'https://user-images.githubusercontent.com/59892368/220364871-f553109d-855f-426a-bbe5-5e1c11278003.svg' > </ img >
97+ </ div >
98+ )
99+
100+ )
101+ }
102+
87103
88104
89105 </ ul >
0 commit comments