1
- import { ArrowUpRight } from 'lucide-react'
1
+ import { ArrowUpRight , Copy , CopyCheck } from 'lucide-react'
2
2
import ThemeSwitch from './ThemeSwitch'
3
3
import { useMediaQuery } from '@/hooks/useMediaQuery'
4
4
import BlurFade , { BLUR_FADE_DELAY } from '@/components/ui/BlurFade'
5
5
import Image from 'next/image'
6
6
7
- const Header = ( ) => {
7
+ import { useEffect , useState } from 'react' ;
8
+ import copy from 'copy-to-clipboard' ;
9
+
10
+ export type HeaderProps = {
11
+ name : string ,
12
+ pronouns : string ,
13
+ currentEducation : string ,
14
+ currentJob ?: string ,
15
+ githubLink : string ,
16
+ linkedinLink : string ,
17
+ email : string ,
18
+ resumeFile : string ,
19
+ }
20
+
21
+ const Header = ( { name, pronouns, currentEducation, currentJob, githubLink, linkedinLink, email, resumeFile} : HeaderProps ) => {
8
22
const isDesktop = useMediaQuery ( '(min-width: 768px)' )
9
- const githubLink : string = "https://github.com/steadyfall"
10
- const linkedinLink : string = "https://www.linkedin.com/in/himank-dave/"
23
+ const [ copied , setCopiedId ] = useState < string > ( ) ;
24
+ useEffect ( ( ) => { setTimeout ( ( ) => { setCopiedId ( undefined ) ; } , 3000 ) } , [ copied ] ) ;
25
+
11
26
return (
12
27
< header className = "container mx-auto px-4 py-8" >
13
28
< div className = "flex flex-col md:flex-row items-center justify-between" >
@@ -27,7 +42,7 @@ const Header = () => {
27
42
< div className = "flex-grow text-center md:text-left" >
28
43
< BlurFade delay = { BLUR_FADE_DELAY } >
29
44
< div className = "flex items-center justify-center md:justify-start" >
30
- < h1 className = "text-4xl md:text-5xl lg:text-6xl font-bold mr-4" > Himank Dave </ h1 >
45
+ < h1 className = "text-4xl md:text-5xl lg:text-6xl font-bold mr-4" > { name } </ h1 >
31
46
< ThemeSwitch />
32
47
</ div >
33
48
</ BlurFade >
@@ -47,29 +62,57 @@ const Header = () => {
47
62
</ a >
48
63
</ BlurFade >
49
64
< BlurFade delay = { BLUR_FADE_DELAY } >
50
- < a href = " mailto:[email protected] " aria-label = "Email"
65
+ < a href = { ` mailto:` + email } aria-label = "Email"
51
66
className = "inline-flex items-center hover:underline hover:underline-offset-2 text-azure-radiance-600" // text-orange-500"
52
67
>
53
68
email < ArrowUpRight className = "w-4 h-4 md:w-5 md:h-5" />
54
69
</ a >
55
70
</ BlurFade >
56
71
< BlurFade delay = { BLUR_FADE_DELAY } >
57
- < a href = "/resume.pdf" target = "_blank" aria-label = "Resume"
72
+ < a href = { `/` + resumeFile } target = "_blank" aria-label = "Resume"
58
73
className = "inline-flex items-center hover:underline hover:underline-offset-2 text-neon-green-500 dark:text-neon-green-400"
59
74
>
60
75
resume < ArrowUpRight className = "w-4 h-4 md:w-5 md:h-5" />
61
76
</ a >
62
77
</ BlurFade >
63
78
</ div >
64
79
< div className = "mt-4 text-sm md:text-base lg:text-lg" >
80
+ { pronouns && ( < BlurFade delay = { BLUR_FADE_DELAY } >
81
+ < p > { pronouns } </ p >
82
+ </ BlurFade > ) }
83
+ { currentJob && ( < BlurFade delay = { BLUR_FADE_DELAY } >
84
+ < p > { currentJob } </ p >
85
+ </ BlurFade > ) }
86
+ { currentEducation && ( < BlurFade delay = { BLUR_FADE_DELAY } >
87
+ < p > { currentEducation } </ p >
88
+ </ BlurFade > ) }
65
89
< BlurFade delay = { BLUR_FADE_DELAY } >
66
- < p > he/him/his</ p >
67
- </ BlurFade >
68
- < BlurFade delay = { BLUR_FADE_DELAY } >
69
- < p > 3A Computational Mathematics @ UWaterloo</ p >
70
- </ BlurFade >
71
- < BlurFade delay = { BLUR_FADE_DELAY } >
72
- < p className = "font-typewriter" > hddave[at]uwaterloo.ca</ p >
90
+ < div className = "inline-flex" >
91
+ < p className = "font-typewriter" >
92
+ { email . split ( '' ) . map (
93
+ ( char ) => {
94
+ return ( char === '@' ) ? "[at]" : char ;
95
+ }
96
+ ) }
97
+ </ p >
98
+ < button
99
+ className = "ml-3 text-slate-600 dark:text-slate-300 hover:text-black dark:hover:text-white cursor-pointer"
100
+ onClick = { async ( ) => {
101
+ if ( 'clipboard' in navigator ) {
102
+ await navigator . clipboard . writeText ( email ) ;
103
+ } else {
104
+ copy ( email ) ;
105
+ }
106
+ setCopiedId ( 'copied-email' ) ;
107
+ } }
108
+ >
109
+ {
110
+ copied === 'copied-email'
111
+ ? < CopyCheck className = "w-4 h-4 md:w-5 md:h-5" />
112
+ : < Copy className = "w-4 h-4 md:w-5 md:h-5" />
113
+ }
114
+ </ button >
115
+ </ div >
73
116
</ BlurFade >
74
117
</ div >
75
118
</ div >
0 commit comments