Skip to content

Commit 9fe9dbb

Browse files
ux(certificate): restyle readme badge block
Make the badge preview block match the app's flat record-card design and improve wrapping/alignment with the copy button. Made-with: Cursor
1 parent 91317e7 commit 9fe9dbb

2 files changed

Lines changed: 40 additions & 38 deletions

File tree

src/app/globals.css

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,15 +344,13 @@ button {
344344

345345
/* README badge preview block — shields badge + copy button grouped */
346346
.readme-badge-block {
347-
margin-top: 8px;
348-
padding: 14px;
349-
border: 1px solid #e5dcc8;
350-
background: rgba(255, 255, 255, 0.28);
347+
margin-top: 10px;
348+
background: var(--c-surface);
351349
}
352350
.readme-badge-row {
353351
display: flex;
354352
align-items: center;
355-
justify-content: space-between;
353+
justify-content: center;
356354
gap: 12px;
357355
flex-wrap: wrap;
358356
}

src/components/CertificateCard.tsx

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -632,40 +632,44 @@ 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 className="readme-badge-block">
636-
<div className="readme-badge-row">
637-
{/* eslint-disable-next-line @next/next/no-img-element */}
638-
<img
639-
src={shieldsUrl}
640-
alt="README badge preview"
641-
loading="lazy"
642-
decoding="async"
643-
style={{ height: '28px', width: 'auto', display: 'block', flexShrink: 0 }}
644-
/>
645-
<button
646-
type="button"
647-
onClick={async () => { try { await navigator.clipboard.writeText(badgeMd); setBadgeCopied(true); setTimeout(() => setBadgeCopied(false), 2000) } catch { /* ignore */ } }}
648-
className="readme-copy-btn"
649-
style={{
650-
fontFamily: MONO, fontSize: '10px', fontWeight: 700, letterSpacing: '0.06em',
651-
padding: '8px 14px', minHeight: '36px',
652-
background: badgeCopied ? '#2d7a3c' : 'transparent',
653-
color: badgeCopied ? '#fff' : '#4a4440',
654-
border: `2px solid ${badgeCopied ? '#2d7a3c' : '#cec6bb'}`,
655-
cursor: 'pointer',
656-
transition: 'all 0.15s',
657-
whiteSpace: 'nowrap',
658-
flexShrink: 0,
659-
}}
660-
onMouseEnter={e => { if (!badgeCopied) { e.currentTarget.style.borderColor = '#1a1a1a'; e.currentTarget.style.color = '#1a1a1a' } }}
661-
onMouseLeave={e => { if (!badgeCopied) { e.currentTarget.style.borderColor = '#cec6bb'; e.currentTarget.style.color = '#4a4440' } }}
662-
>
663-
{badgeCopied ? '✓ copied!' : '⎘ copy to readme'}
664-
</button>
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' }}>
639+
{/* eslint-disable-next-line @next/next/no-img-element */}
640+
<img
641+
src={shieldsUrl}
642+
alt="README badge preview"
643+
loading="lazy"
644+
decoding="async"
645+
style={{ height: '28px', width: 'auto', display: 'block', flexShrink: 0 }}
646+
/>
647+
</div>
648+
<button
649+
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,
662+
}}
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' } }}
665+
>
666+
{badgeCopied ? '✓ copied!' : '⎘ copy to readme'}
667+
</button>
668+
</div>
669+
<p className="readme-badge-caption" style={{ fontFamily: MONO, textAlign: 'left' }}>
670+
↻ paste once — updates automatically
671+
</p>
665672
</div>
666-
<p className="readme-badge-caption" style={{ fontFamily: MONO }}>
667-
↻ paste once — updates automatically
668-
</p>
669673
</div>
670674
)
671675
})()}

0 commit comments

Comments
 (0)