Skip to content

Commit 67b690f

Browse files
Unify community share cards and rich previews
1 parent dd7fe33 commit 67b690f

9 files changed

Lines changed: 594 additions & 270 deletions

File tree

.github/workflows/generate-share-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- "s/**"
88
- "og/**"
99
schedule:
10-
- cron: "*/10 * * * *"
10+
- cron: "*/5 * * * *"
1111
workflow_dispatch:
1212

1313
permissions:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Pages deploys from the default branch root with the custom domain
1919
The companion `../link-edge/` renderer server-renders per-script Open Graph
2020
metadata and creates a 1200×630 PNG card from the existing public community
2121
API. The GitHub Actions workflow in `.github/workflows/` runs this renderer on
22-
every source publish and every ten minutes, committing generated `/s/*/` pages
22+
every source publish and every five minutes, committing generated `/s/*/` pages
2323
and `/og/*` cards to GitHub Pages. This is required because WeChat does not
2424
reliably execute page JavaScript when building a link preview.
2525

assets/share-page.css

Lines changed: 116 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
--black: #080808;
1313
--white: #ffffff;
1414
--code: #202123;
15-
--radius: 8px;
15+
--radius: 18px;
1616
--ease: cubic-bezier(0.19, 1, 0.22, 1);
1717
--font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
1818
--mono: "SF Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
@@ -320,17 +320,80 @@ h1 {
320320
border: 1px solid var(--line);
321321
border-radius: var(--radius);
322322
background: var(--white);
323-
box-shadow: 0 14px 34px rgba(0, 0, 0, 0.055);
323+
box-shadow: 0 16px 42px rgba(0, 0, 0, 0.065);
324324
transition: transform 400ms var(--ease), box-shadow 400ms ease;
325325
}
326326

327327
.work-card:hover {
328328
box-shadow: 0 20px 48px rgba(0, 0, 0, 0.075);
329329
}
330330

331+
.work-typebar {
332+
height: 46px;
333+
padding: 0 13px;
334+
border-bottom: 1px solid var(--line);
335+
display: flex;
336+
align-items: center;
337+
justify-content: space-between;
338+
gap: 14px;
339+
background: rgba(255, 255, 255, 0.96);
340+
}
341+
342+
.work-type {
343+
min-width: 0;
344+
display: flex;
345+
align-items: center;
346+
gap: 9px;
347+
}
348+
349+
.type-symbol {
350+
width: 28px;
351+
height: 28px;
352+
flex: 0 0 auto;
353+
border: 1px solid var(--line);
354+
border-radius: 9px;
355+
display: grid;
356+
place-items: center;
357+
background: var(--soft);
358+
color: var(--ink);
359+
font-family: var(--mono);
360+
font-size: 9px;
361+
font-weight: 700;
362+
letter-spacing: -0.04em;
363+
}
364+
365+
.type-symbol svg,
366+
.poster-symbol svg {
367+
width: 58%;
368+
height: 58%;
369+
display: block;
370+
fill: none;
371+
stroke: currentColor;
372+
stroke-width: 1.7;
373+
stroke-linecap: round;
374+
stroke-linejoin: round;
375+
}
376+
377+
.work-type strong {
378+
overflow: hidden;
379+
color: var(--ink);
380+
font-size: 12px;
381+
font-weight: 650;
382+
text-overflow: ellipsis;
383+
white-space: nowrap;
384+
}
385+
386+
.preview-kind {
387+
flex: 0 0 auto;
388+
color: var(--muted);
389+
font-size: 11px;
390+
font-weight: 520;
391+
white-space: nowrap;
392+
}
393+
331394
.preview-viewport {
332395
position: relative;
333-
height: clamp(170px, 27svh, 238px);
396+
height: clamp(170px, 24svh, 202px);
334397
overflow: hidden;
335398
background: var(--code);
336399
}
@@ -359,8 +422,7 @@ h1 {
359422

360423
.code-preview,
361424
.cover-preview,
362-
.project-preview,
363-
.generic-preview {
425+
.poster-preview {
364426
width: 100%;
365427
height: 100%;
366428
}
@@ -372,23 +434,10 @@ h1 {
372434
color: #ececec;
373435
}
374436

375-
.code-toolbar {
376-
height: 32px;
377-
padding: 0 14px;
378-
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
379-
display: flex;
380-
align-items: center;
381-
justify-content: space-between;
382-
color: #969698;
383-
font-family: var(--mono);
384-
font-size: 9px;
385-
letter-spacing: 0.04em;
386-
}
387-
388437
.code-preview pre {
389-
height: calc(100% - 32px);
438+
height: 100%;
390439
margin: 0;
391-
padding: 13px 0 38px;
440+
padding: 18px 0 38px;
392441
overflow: hidden;
393442
font-family: var(--mono);
394443
font-size: 10.5px;
@@ -441,85 +490,68 @@ h1 {
441490
object-fit: cover;
442491
}
443492

444-
.project-preview {
493+
.poster-preview {
445494
position: relative;
446-
padding: clamp(24px, 5svh, 42px) 28px 20px;
495+
padding: 24px;
447496
overflow: hidden;
448497
background: var(--code);
449-
color: #f4f4f4;
450-
}
451-
452-
.project-preview h2,
453-
.generic-preview h2 {
454-
position: relative;
455-
margin: 6px 0 0;
456-
overflow: hidden;
457-
font-size: clamp(21px, 5vw, 30px);
458-
font-weight: 650;
459-
letter-spacing: -0.025em;
460-
line-height: 1.1;
461-
text-overflow: ellipsis;
462-
white-space: nowrap;
463498
}
464499

465-
.project-preview > p:not(.project-kicker),
466-
.generic-preview p {
467-
position: relative;
468-
max-width: 430px;
469-
margin: 8px 0 0;
470-
overflow: hidden;
471-
display: -webkit-box;
472-
color: #ababac;
473-
font-size: 12px;
474-
line-height: 1.45;
475-
-webkit-box-orient: vertical;
476-
-webkit-line-clamp: 2;
477-
}
478-
479-
.project-kicker {
480-
position: relative;
481-
color: #9c9c9e;
482-
font-family: var(--mono);
483-
font-size: 9px;
484-
text-transform: uppercase;
500+
.poster-grid {
501+
position: absolute;
502+
inset: 0;
503+
opacity: 0.46;
504+
background-image:
505+
linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
506+
linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
507+
background-size: 42px 42px;
508+
mask-image: linear-gradient(90deg, black, transparent 76%);
509+
-webkit-mask-image: linear-gradient(90deg, black, transparent 76%);
485510
}
486511

487-
.project-orbit {
512+
.poster-lines {
488513
position: absolute;
489-
top: -118px;
490-
right: -86px;
491-
width: 280px;
492-
height: 280px;
493-
border: 1px solid rgba(255, 255, 255, 0.1);
494-
border-radius: 50%;
514+
top: 50%;
515+
left: 34px;
516+
width: min(58%, 360px);
517+
display: grid;
518+
gap: 12px;
519+
transform: translateY(-50%);
495520
}
496521

497-
.project-orbit::before,
498-
.project-orbit::after {
499-
content: "";
500-
position: absolute;
501-
border: 1px solid rgba(255, 255, 255, 0.07);
502-
border-radius: 50%;
522+
.poster-lines span {
523+
height: 8px;
524+
border-radius: 999px;
525+
background: rgba(255, 255, 255, 0.82);
503526
}
504527

505-
.project-orbit::before { inset: 44px; }
506-
.project-orbit::after { inset: 88px; }
528+
.poster-lines span:nth-child(1) { width: 78%; }
529+
.poster-lines span:nth-child(2) { width: 100%; background: rgba(255, 255, 255, 0.47); }
530+
.poster-lines span:nth-child(3) { width: 62%; }
507531

508-
.project-orbit span {
532+
.poster-symbol {
509533
position: absolute;
510-
width: 8px;
511-
height: 8px;
512-
border-radius: 50%;
513-
background: #b5b5b7;
534+
top: 50%;
535+
right: clamp(30px, 8vw, 70px);
536+
width: clamp(88px, 20vw, 126px);
537+
height: clamp(88px, 20vw, 126px);
538+
border: 1px solid rgba(255, 255, 255, 0.08);
539+
border-radius: 32px;
540+
display: grid;
541+
place-items: center;
542+
background: rgba(255, 255, 255, 0.045);
543+
color: rgba(255, 255, 255, 0.93);
544+
font-family: var(--mono);
545+
font-size: clamp(19px, 4vw, 27px);
546+
font-weight: 650;
547+
transform: translateY(-50%) rotate(-2deg);
514548
}
515549

516-
.project-orbit span:nth-child(1) { left: 28px; bottom: 64px; }
517-
.project-orbit span:nth-child(2) { left: 104px; bottom: 66px; background: #f2f2f2; }
518-
.project-orbit span:nth-child(3) { left: 136px; bottom: 128px; }
519-
520550
.project-facts {
521-
position: relative;
522-
margin-top: 12px;
551+
position: absolute;
552+
right: 20px;
553+
bottom: 16px;
554+
left: 20px;
523555
display: flex;
524556
flex-wrap: wrap;
525557
gap: 5px;
@@ -534,35 +566,8 @@ h1 {
534566
font-size: 9px;
535567
}
536568

537-
.generic-preview {
538-
padding: 24px;
539-
display: flex;
540-
align-items: center;
541-
justify-content: center;
542-
gap: 16px;
543-
background: var(--soft);
544-
}
545-
546-
.generic-symbol {
547-
width: 58px;
548-
height: 58px;
549-
flex: 0 0 auto;
550-
border: 1px solid var(--line);
551-
border-radius: 16px;
552-
display: grid;
553-
place-items: center;
554-
background: var(--white);
555-
font-family: var(--mono);
556-
font-size: 16px;
557-
font-weight: 600;
558-
}
559-
560-
.generic-preview p {
561-
color: var(--muted);
562-
}
563-
564569
.stats {
565-
min-height: 36px;
570+
height: 42px;
566571
padding: 0 7px;
567572
border-top: 1px solid var(--line);
568573
display: grid;
@@ -990,7 +995,7 @@ body:not(.is-loading) .loading-label {
990995
}
991996

992997
.preview-viewport {
993-
height: clamp(260px, 38svh, 340px);
998+
height: clamp(220px, 31svh, 270px);
994999
}
9951000
}
9961001

0 commit comments

Comments
 (0)