Skip to content

Commit bf2b9a5

Browse files
ux(cert): fix badge block spacing on mobile
Made-with: Cursor
1 parent 4214329 commit bf2b9a5

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

src/app/globals.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ button {
425425
display: flex;
426426
align-items: center;
427427
justify-content: center;
428-
flex: 1 1 240px;
428+
flex: 0 0 auto;
429429
}
430430

431431
.cert-readme-copy-btn {
@@ -763,6 +763,7 @@ a.subpage-inline-mail {
763763
}
764764
.cert-readme-badge-preview {
765765
justify-content: flex-start;
766+
flex: 0 0 auto;
766767
}
767768

768769
}

src/components/CertificateCard.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { track } from '@vercel/analytics'
77
import { DeathCertificate } from '@/lib/types'
88
import CertificateFixed from '@/components/CertificateFixed'
99
import GitHubIcon from '@/components/GitHubIcon'
10+
import { copyText, promptCopy } from '@/lib/clipboard'
1011

1112
// Lazy-load html-to-image (~40KB) on first share/download interaction so it
1213
// stays out of the critical bundle.
@@ -648,13 +649,10 @@ export default function CertificateCard({ cert, onReset }: Props) {
648649
<button
649650
type="button"
650651
onClick={async () => {
651-
try {
652-
await navigator.clipboard.writeText(badgeMd)
653-
setBadgeCopied(true)
654-
setTimeout(() => setBadgeCopied(false), 2000)
655-
} catch {
656-
// ignore
657-
}
652+
const ok = await copyText(badgeMd)
653+
if (!ok) promptCopy(badgeMd, 'Copy this README badge markdown')
654+
setBadgeCopied(true)
655+
setTimeout(() => setBadgeCopied(false), 2000)
658656
}}
659657
className="readme-copy-btn cert-readme-copy-btn"
660658
>

0 commit comments

Comments
 (0)