Skip to content

Commit 01fd646

Browse files
ux(cert): redesign readme badge row
Made-with: Cursor
1 parent 2277b4f commit 01fd646

2 files changed

Lines changed: 63 additions & 20 deletions

File tree

src/app/globals.css

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,44 @@ button {
399399
max-width: 100%;
400400
}
401401

402+
/* Certificate view: README badge block (cleaner layout) */
403+
.cert-readme-badge-wrap {
404+
width: 100%;
405+
display: flex;
406+
justify-content: center;
407+
}
408+
409+
.cert-readme-badge {
410+
width: min(520px, 100%);
411+
border: 2px solid var(--c-border);
412+
box-shadow: 0 1px 4px rgba(0,0,0,0.05);
413+
padding: 14px 16px;
414+
}
415+
416+
.cert-readme-badge-top {
417+
display: flex;
418+
align-items: center;
419+
justify-content: space-between;
420+
gap: 12px;
421+
flex-wrap: wrap;
422+
}
423+
424+
.cert-readme-badge-preview {
425+
display: flex;
426+
align-items: center;
427+
justify-content: center;
428+
flex: 1 1 240px;
429+
}
430+
431+
.cert-readme-copy-btn {
432+
flex: 0 0 auto;
433+
}
434+
435+
.cert-readme-caption {
436+
margin: 10px 0 0;
437+
text-align: left;
438+
}
439+
402440
.subpage-faq-cta {
403441
display: inline-flex;
404442
align-items: center;
@@ -717,6 +755,16 @@ a.subpage-inline-mail {
717755
width: 100%;
718756
}
719757

758+
/* Certificate badge: stack cleanly on mobile */
759+
.cert-readme-badge-top {
760+
flex-direction: column;
761+
align-items: stretch;
762+
gap: 10px;
763+
}
764+
.cert-readme-badge-preview {
765+
justify-content: flex-start;
766+
}
767+
720768
}
721769

722770
.cert-mobile-hint {

src/components/CertificateCard.tsx

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -632,41 +632,36 @@ export default function CertificateCard({ cert, onReset }: Props) {
632632
const shieldsUrl = `https://img.shields.io/badge/%F0%9F%AA%A6%20declared%20dead-view%20certificate-555?style=for-the-badge&labelColor=cc0000`
633633
const badgeMd = `[![commitmentissues](${shieldsUrl})](${repoUrl})`
634634
return (
635-
<div style={{ width: '100%', display: 'flex', justifyContent: 'center' }}>
636-
<div className="readme-badge-block record-card" style={{ border: '2px solid #1a1a1a', boxShadow: '0 1px 4px rgba(0,0,0,0.05)', padding: '14px 16px', width: '100%' }}>
637-
<div className="readme-badge-row">
638-
<div style={{ display: 'flex', justifyContent: 'center', flex: '1 1 260px' }}>
635+
<div className="cert-readme-badge-wrap">
636+
<div className="cert-readme-badge record-card">
637+
<div className="cert-readme-badge-top">
638+
<div className="cert-readme-badge-preview">
639639
{/* eslint-disable-next-line @next/next/no-img-element */}
640640
<img
641641
src={shieldsUrl}
642642
alt="README badge preview"
643643
loading="lazy"
644644
decoding="async"
645-
style={{ height: '28px', width: 'auto', display: 'block', flexShrink: 0 }}
645+
style={{ height: '28px', width: 'auto', display: 'block' }}
646646
/>
647647
</div>
648648
<button
649649
type="button"
650-
onClick={async () => { try { await navigator.clipboard.writeText(badgeMd); setBadgeCopied(true); setTimeout(() => setBadgeCopied(false), 2000) } catch { /* ignore */ } }}
651-
className="readme-copy-btn"
652-
style={{
653-
fontFamily: MONO, fontSize: '10px', fontWeight: 700, letterSpacing: '0.06em',
654-
padding: '8px 14px', minHeight: '36px',
655-
background: badgeCopied ? '#2d7a3c' : 'transparent',
656-
color: badgeCopied ? '#fff' : '#4a4440',
657-
border: `2px solid ${badgeCopied ? '#2d7a3c' : '#cec6bb'}`,
658-
cursor: 'pointer',
659-
transition: 'all 0.15s',
660-
whiteSpace: 'nowrap',
661-
flexShrink: 0,
650+
onClick={async () => {
651+
try {
652+
await navigator.clipboard.writeText(badgeMd)
653+
setBadgeCopied(true)
654+
setTimeout(() => setBadgeCopied(false), 2000)
655+
} catch {
656+
// ignore
657+
}
662658
}}
663-
onMouseEnter={e => { if (!badgeCopied) { e.currentTarget.style.borderColor = '#1a1a1a'; e.currentTarget.style.color = '#1a1a1a' } }}
664-
onMouseLeave={e => { if (!badgeCopied) { e.currentTarget.style.borderColor = '#cec6bb'; e.currentTarget.style.color = '#4a4440' } }}
659+
className="readme-copy-btn cert-readme-copy-btn"
665660
>
666661
{badgeCopied ? '✓ copied!' : '⎘ copy to readme'}
667662
</button>
668663
</div>
669-
<p className="readme-badge-caption" style={{ fontFamily: MONO, textAlign: 'left' }}>
664+
<p className="readme-badge-caption cert-readme-caption" style={{ fontFamily: MONO }}>
670665
↻ paste once — updates automatically
671666
</p>
672667
</div>

0 commit comments

Comments
 (0)