1
- import React , { useState } from "react" ;
1
+ import React , { useEffect , useRef , useState } from "react" ;
2
2
import Container from "@/components/Container" ;
3
3
import Link from "next/link" ;
4
4
import ProjectCard from "@/components/ProjectCard" ;
@@ -9,9 +9,17 @@ import { useRouter } from "next/router";
9
9
10
10
import cards from "@/constants/boxshadows/cards" ;
11
11
import Footer from "@/components/Footer" ;
12
+ import { GenerateBoxShadow } from "@/components/BoxShadows/GenerateBoxShadow" ;
13
+ import { useTheme } from "next-themes" ;
12
14
13
15
export default function BoxShadows ( ) {
14
16
const [ visible , setVisible ] = useState ( false ) ;
17
+ const { theme, setTheme } = useTheme ( ) ;
18
+ const [ mounted , setMounted ] = useState ( false ) ;
19
+ const scrollRef = useRef ( null ) ;
20
+
21
+ useEffect ( ( ) => setMounted ( true ) , [ ] ) ;
22
+ const executeScroll = ( ) => scrollRef . current . scrollIntoView ( ) ;
15
23
16
24
const onModalClick = ( ) => {
17
25
setVisible ( ! visible ) ;
@@ -20,9 +28,14 @@ export default function BoxShadows() {
20
28
return (
21
29
< div >
22
30
< Metadata />
23
- < CustomNav onModalClick = { onModalClick } />
31
+ < CustomNav
32
+ setTheme = { setTheme }
33
+ theme = { theme }
34
+ mounted = { mounted }
35
+ onModalClick = { onModalClick }
36
+ />
24
37
< div className = "light flex flex-col justify-center items-start mx-auto mb-16" >
25
- < Header />
38
+ < Header executeScroll = { executeScroll } />
26
39
{ visible && < Modal onModalClick = { onModalClick } /> }
27
40
28
41
< div className = "grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 items-center w-full gap-y-20 mb-40" >
@@ -43,7 +56,7 @@ export default function BoxShadows() {
43
56
/>
44
57
</ >
45
58
</ div >
46
-
59
+ < GenerateBoxShadow ref = { scrollRef } />
47
60
< div className = "w-full lg:max-w-2xl px-4 sm:mx-auto" >
48
61
< Contact />
49
62
< Footer />
@@ -157,7 +170,7 @@ const Card = ({ shadow, name, vanillaCSS, customCSS }) => {
157
170
) ;
158
171
} ;
159
172
160
- const Header = ( ) => {
173
+ const Header = ( { executeScroll } ) => {
161
174
return (
162
175
< div className = "mb-20 flex flex-col items-center justify-center w-full" >
163
176
< a
@@ -181,7 +194,7 @@ const Header = () => {
181
194
A curated list of box shadows for TailwindCSS. Available in JIT 🚀 and
182
195
vanilla CSS.
183
196
</ h2 >
184
- < p className = "prose text-gray-700 font-light dark:text-gray-400 mb-20 text-center mx-auto" >
197
+ < p className = "prose text-gray-700 font-light dark:text-gray-400 text-center mx-auto" >
185
198
< span className = "bg-gray-800 border border-gray-100 rounded-md px-1 py-1" >
186
199
🖱
187
200
</ span > { " " }
@@ -191,56 +204,93 @@ const Header = () => {
191
204
</ span > { " " }
192
205
to bookmark this page.
193
206
</ p > { " " }
207
+ < div className = "w-full items-center max-w-sm mx-auto flex flex-row space-x-2 text-xs text-gray-500 font-light dark:text-gray-400 my-10" >
208
+ < div className = "h-px w-full bg-slate-200 dark:bg-slate-700" > </ div >
209
+ < p > or</ p >
210
+ < div className = "h-px w-full bg-slate-200 dark:bg-slate-700" > </ div >
211
+ </ div >
212
+ < button
213
+ onClick = { executeScroll }
214
+ className = "bg-black/90 px-4 py-2 rounded-md"
215
+ >
216
+ < div class = " animate-text-shimmer bg-clip-text text-transparent bg-[linear-gradient(110deg,#e2e8f0,45%,#1e293b,55%,#e2e8f0)] bg-[length:250%_100%]" >
217
+ Tailwind Box Shadow Generator
218
+ </ div >
219
+ </ button >
194
220
</ div >
195
221
) ;
196
222
} ;
197
223
198
- const CustomNav = ( { onModalClick } ) => {
224
+ const CustomNav = ( { onModalClick, setTheme , theme , mounted } ) => {
199
225
return (
200
- < nav className = "w-full h-16 bg-white border-b border-t border-gray-100 px-4 md:px-20 flex flex-row justify-between items-center" >
201
- < Link href = "/" >
202
- < a >
203
- < Image
204
- src = "/logo.png"
205
- className = "h-full w-full rounded-md"
206
- width = "40px"
207
- height = "40px"
208
- />
209
- </ a >
210
- </ Link >
226
+ < nav className = "w-full h-16 bg-white dark:bg-zinc-700 dark:border-0 border-b border-t border-gray-100 px-4 md:px-20 flex flex-row justify-between items-center" >
227
+ < div className = "flex items-center space-x-2" >
228
+ < Link href = "/" >
229
+ < a >
230
+ < Image
231
+ src = "/logo.png"
232
+ className = "h-full w-full rounded-md"
233
+ width = "40px"
234
+ height = "40px"
235
+ />
236
+ </ a >
237
+ </ Link >
238
+ </ div >
211
239
< div className = "flex flex-row items-center" >
240
+ { " " }
212
241
< a
213
242
href = "https://github.com/manuarora700/manuarora.in/blob/master/pages/boxshadows.js"
214
243
target = "__blank"
215
244
className = "text-gray-400 underline hidden sm:block text-sm font-normal mr-4"
216
245
>
217
246
Code? Here.
218
247
</ a >
248
+ < button
249
+ aria-label = "Toggle Dark Mode"
250
+ type = "button"
251
+ className = "group rounded-full mr-4 bg-white/90 px-3 py-2 shadow-lg shadow-zinc-800/5 ring-1 ring-zinc-900/5 backdrop-blur transition dark:bg-zinc-900/90 dark:ring-teal-500/50 dark:hover:ring-white/20"
252
+ onClick = { ( ) => setTheme ( theme === "dark" ? "light" : "dark" ) }
253
+ >
254
+ { mounted && (
255
+ < svg
256
+ xmlns = "http://www.w3.org/2000/svg"
257
+ viewBox = "0 0 24 24"
258
+ fill = "currentColor"
259
+ stroke = "currentColor"
260
+ className = "h-4 w-4 text-gray-800 dark:text-teal-500"
261
+ >
262
+ { theme === "dark" ? (
263
+ < path
264
+ strokeLinecap = "round"
265
+ strokeLinejoin = "round"
266
+ strokeWidth = { 2 }
267
+ d = "M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"
268
+ />
269
+ ) : (
270
+ < path
271
+ strokeLinecap = "round"
272
+ strokeLinejoin = "round"
273
+ strokeWidth = { 2 }
274
+ d = "M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"
275
+ />
276
+ ) }
277
+ </ svg >
278
+ ) }
279
+ </ button >
219
280
< button
220
281
onClick = { onModalClick }
221
282
className = "text-white hidden sm:block border border-gray-700 bg-black text-sm font-normal rounded-md px-2 py-2 mr-4"
222
283
>
223
284
Custom CSS to JIT 🚀
224
285
</ button >
225
- { /* <a
226
- href="https://www.producthunt.com/posts/tailwind-box-shadows"
227
- target="__blank"
228
- className="text-[#EA532A] text-sm font-bold border border-[#EA532A] rounded-md px-2 py-2"
229
- >
230
- Upvote on ProductHunt
231
- </a> */ }
232
286
< a
233
287
href = "https://www.producthunt.com/posts/tailwind-box-shadows?utm_source=badge-featured& utm_medium = badge & utm_souce = badge - tailwind-box-shadows "
234
288
target = "_blank"
235
289
>
236
290
< img
237
291
src = "https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=325075& theme = dark "
238
292
alt = "Tailwind Box Shadows - Curated list of box shadows for your cards to stand out | Product Hunt"
239
- // style={"width: 250px; height: 54px;"}
240
- // style={{ width: "250px", height: "54px" }}
241
293
className = "h-10 w-auto"
242
- // width="250"
243
- // height="54"
244
294
/>
245
295
</ a >
246
296
</ div >
0 commit comments