@@ -5,6 +5,7 @@ import { getHooks } from "@/lib/get-hooks";
5
5
import { ScrollArea } from "@workspace/ui/components/scroll-area" ;
6
6
import { Anchor } from "lucide-react" ;
7
7
import { Separator } from "@workspace/ui/components/separator" ;
8
+ import { CaterogyButton } from "@/components/category-button" ;
8
9
9
10
export const metadata : Metadata = {
10
11
title : "useHooks - React Hooks Library" ,
@@ -118,56 +119,54 @@ export default async function HomePage() {
118
119
< div className = "flex flex-wrap justify-center gap-4" >
119
120
{ Array . from ( new Set ( hooks . map ( ( hook ) => hook . category ) ) ) . map (
120
121
( category , index ) => (
121
- < div
122
+ < CaterogyButton
122
123
key = { category }
123
- className = "animate-in fade-in-0 slide-in-from-bottom-4"
124
- style = { { animationDelay : `${ 1500 + index * 100 } ms` } }
125
- >
126
- < div className = "rounded-full bg-primary/10 px-4 py-2 text-sm font-medium transition-colors hover:bg-primary/20" >
127
- { category }
128
- < span className = "ml-2 text-xs text-muted-foreground" >
129
- (
130
- {
131
- hooks . filter ( ( hook ) => hook . category === category )
132
- . length
133
- }
134
- )
135
- </ span >
136
- </ div >
137
- </ div >
124
+ category = { category }
125
+ index = { index }
126
+ hooks = { hooks }
127
+ />
138
128
)
139
129
) }
140
130
</ div >
141
131
</ div >
142
132
143
- < div className = "grid gap-6 md:grid-cols-2 lg:grid-cols-3" >
144
- { hooks . map ( ( hook , index ) => (
145
- < div
146
- className = { `container mx-auto py-12 transition-all duration-200 hover:scale-105 animate-in fade-in-0 slide-in-from-bottom-4` }
147
- style = { {
148
- animationDelay : `${ 2100 + index * 100 } ms` ,
149
- } }
150
- key = { hook . name }
151
- >
152
- < Link
153
- href = { `/docs/${ hook . name } ` }
154
- className = "block transition-colors duration-200 hover:text-primary"
155
- >
156
- < h1 className = "text-4xl font-bold mb-2 transition-colors duration-200" >
157
- { hook . name }
158
- </ h1 >
159
- </ Link >
160
- < span className = "inline-block bg-gray-200 dark:bg-gray-700 text-sm px-2 py-1 rounded mb-8 transition-all duration-200 hover:bg-primary/20" >
161
- { hook . category }
162
- </ span >
133
+ { Array . from ( new Set ( hooks . map ( ( hook ) => hook . category ) ) ) . map (
134
+ ( category ) => (
135
+ < div key = { category } id = { category } >
136
+ < h3 className = "text-2xl font-bold mt-16 mb-8" > { category } </ h3 >
137
+ < div className = "grid gap-6 md:grid-cols-2 lg:grid-cols-3" >
138
+ { hooks
139
+ . filter ( ( hook ) => hook . category === category )
140
+ . map ( ( hook , index ) => (
141
+ < div
142
+ className = { `container mx-auto py-12 transition-all duration-200 hover:scale-105 animate-in fade-in-0 slide-in-from-bottom-4` }
143
+ style = { {
144
+ animationDelay : `${ 2100 + index * 100 } ms` ,
145
+ } }
146
+ key = { hook . name }
147
+ >
148
+ < Link
149
+ href = { `/docs/${ hook . name } ` }
150
+ className = "block transition-colors duration-200 hover:text-primary"
151
+ >
152
+ < h1 className = "text-4xl font-bold mb-2 transition-colors duration-200" >
153
+ { hook . title }
154
+ </ h1 >
155
+ </ Link >
156
+ < span className = "inline-block bg-gray-200 dark:bg-gray-700 text-sm px-2 py-1 rounded mb-8 transition-all duration-200 hover:bg-primary/20" >
157
+ { hook . category }
158
+ </ span >
163
159
164
- < div className = "mb-8" >
165
- < h2 className = "text-2xl font-bold mb-4" > Description</ h2 >
166
- < p className = "text-lg" > { hook . description } </ p >
160
+ < div className = "mb-8" >
161
+ < h2 className = "text-2xl font-bold mb-4" > Description</ h2 >
162
+ < p className = "text-lg" > { hook . description } </ p >
163
+ </ div >
164
+ </ div >
165
+ ) ) }
167
166
</ div >
168
167
</ div >
169
- ) ) }
170
- </ div >
168
+ )
169
+ ) }
171
170
172
171
< Separator
173
172
className = "my-10 animate-in fade-in-0 duration-1000"
0 commit comments