|
| 1 | +import { useState } from "react"; |
1 | 2 | import { featuredMember } from "../../data/mock/members"; |
2 | 3 | import { ExternalLink } from "../ui/ExternalLink"; |
3 | 4 | import { SectionShell } from "../ui/SectionShell"; |
4 | 5 |
|
| 6 | +function CopyEmail({ email }: { email: string }) { |
| 7 | + const [copied, setCopied] = useState(false); |
| 8 | + |
| 9 | + const handleCopy = () => { |
| 10 | + navigator.clipboard.writeText(email).then(() => { |
| 11 | + setCopied(true); |
| 12 | + setTimeout(() => setCopied(false), 2000); |
| 13 | + }); |
| 14 | + }; |
| 15 | + |
| 16 | + return ( |
| 17 | + <dd className="flex items-center gap-2"> |
| 18 | + <a href={`mailto:${email}`} className="hover:text-white/80">{email}</a> |
| 19 | + <button |
| 20 | + onClick={handleCopy} |
| 21 | + className="rounded px-1.5 py-0.5 text-xs text-sky-200 transition hover:bg-white/10 hover:text-white" |
| 22 | + title="Copy email" |
| 23 | + > |
| 24 | + {copied ? "Copied!" : "Copy"} |
| 25 | + </button> |
| 26 | + </dd> |
| 27 | + ); |
| 28 | +} |
| 29 | + |
5 | 30 | export function FeaturedPISection() { |
6 | 31 | return ( |
7 | 32 | <SectionShell className="pt-10 pb-6 sm:pb-6 lg:pb-6"> |
8 | 33 | <div className="overflow-hidden rounded-[2rem] bg-gradient-to-br from-navy via-primary to-secondary p-8 text-white lg:p-10"> |
9 | | - <p className="text-xs font-bold uppercase tracking-[0.25em] text-sky-100">Featured Investigator</p> |
10 | | - |
11 | | - <div className="mt-6 flex items-center gap-5"> |
12 | | - <img |
13 | | - src="/images/prof-chen.png" |
14 | | - alt="陳倩瑜 Prof. Chen, Chien-Yu" |
15 | | - className="h-20 w-20 rounded-full border-2 border-white/30 object-cover" |
16 | | - /> |
17 | | - <div> |
| 34 | + <div className="flex flex-col gap-8 lg:flex-row lg:items-center lg:gap-12"> |
| 35 | + {/* Left column */} |
| 36 | + <div className="flex-1"> |
| 37 | + {/* Name & role */} |
18 | 38 | <h2 className="text-3xl text-white">{featuredMember.name}</h2> |
19 | 39 | <p className="mt-1 text-sm font-semibold uppercase tracking-[0.18em] text-sky-100">{featuredMember.role}</p> |
20 | | - <p className="mt-1 text-sm text-sky-100">{featuredMember.bio}</p> |
21 | | - </div> |
22 | | - </div> |
| 40 | + {featuredMember.bio && <p className="mt-2 text-sm text-sky-100">{featuredMember.bio}</p>} |
23 | 41 |
|
24 | | - <div className="mt-8 grid gap-8 lg:grid-cols-2"> |
25 | | - <dl className="space-y-3 text-sm text-sky-50"> |
26 | | - <div> |
27 | | - <dt className="font-semibold text-white">E-mail</dt> |
28 | | - <dd><a href="mailto:chienyuchen@ntu.edu.tw" className="hover:text-white/80">chienyuchen@ntu.edu.tw</a></dd> |
29 | | - </div> |
30 | | - <div> |
31 | | - <dt className="font-semibold text-white">Tel</dt> |
32 | | - <dd>02-3366-5335 (系主任辦公室)</dd> |
33 | | - <dd>02-3366-5334</dd> |
34 | | - </div> |
35 | | - <div> |
36 | | - <dt className="font-semibold text-white">研究主題</dt> |
37 | | - <dd>生物資訊、資料探勘、機器學習</dd> |
38 | | - </div> |
39 | | - <div> |
40 | | - <dt className="font-semibold text-white">授課領域</dt> |
41 | | - <dd>人工智慧概論、資料結構與演算法、生物資訊基石、生醫資料探勘</dd> |
| 42 | + {/* Contact info */} |
| 43 | + <dl className="mt-6 space-y-3 text-sm text-sky-50"> |
| 44 | + <div> |
| 45 | + <dt className="font-semibold text-white">E-mail</dt> |
| 46 | + <CopyEmail email="chienyuchen@ntu.edu.tw" /> |
| 47 | + </div> |
| 48 | + <div> |
| 49 | + <dt className="font-semibold text-white">Tel</dt> |
| 50 | + <dd>02-3366-5335 (系主任辦公室)</dd> |
| 51 | + <dd>02-3366-5334</dd> |
| 52 | + </div> |
| 53 | + <div> |
| 54 | + <dt className="font-semibold text-white">研究主題</dt> |
| 55 | + <dd>生物資訊、資料探勘、機器學習</dd> |
| 56 | + </div> |
| 57 | + <div> |
| 58 | + <dt className="font-semibold text-white">授課領域</dt> |
| 59 | + <dd>人工智慧概論、資料結構與演算法、生物資訊基石、生醫資料探勘</dd> |
| 60 | + </div> |
| 61 | + </dl> |
| 62 | + |
| 63 | + {/* Photo — mobile only, between info and links */} |
| 64 | + <img |
| 65 | + src="/images/prof-chen.png" |
| 66 | + alt="陳倩瑜 Prof. Chen, Chien-Yu" |
| 67 | + className="mx-auto my-6 w-52 rounded-full object-cover lg:hidden" |
| 68 | + /> |
| 69 | + |
| 70 | + {/* Links */} |
| 71 | + <div className="flex flex-wrap gap-3 lg:mt-6"> |
| 72 | + {featuredMember.links.map((link) => ( |
| 73 | + <ExternalLink key={link.href} href={link.href} className="text-sky-100 hover:text-white"> |
| 74 | + {link.label} |
| 75 | + </ExternalLink> |
| 76 | + ))} |
42 | 77 | </div> |
43 | | - </dl> |
44 | | - |
45 | | - <div className="flex flex-wrap content-start gap-3"> |
46 | | - {featuredMember.links.map((link) => ( |
47 | | - <ExternalLink key={link.href} href={link.href} className="text-sky-100 hover:text-white"> |
48 | | - {link.label} |
49 | | - </ExternalLink> |
50 | | - ))} |
51 | 78 | </div> |
| 79 | + |
| 80 | + {/* Right: photo — desktop only */} |
| 81 | + <img |
| 82 | + src="/images/prof-chen.png" |
| 83 | + alt="陳倩瑜 Prof. Chen, Chien-Yu" |
| 84 | + className="hidden w-72 shrink-0 rounded-full object-cover lg:block" |
| 85 | + /> |
52 | 86 | </div> |
53 | 87 | </div> |
54 | 88 | </SectionShell> |
|
0 commit comments