Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 31 additions & 28 deletions src/components/changelog/Card.astro
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ function embedGithubVideos(html: string): string {
`<video class="changelog-entry-card-video" controls preload="metadata" playsinline src="${url}"></video>`
);
}

type EntryTag = { name: string; description?: string };

// The <Update> description (product name) leads the tag list, ahead of the type tags.
function entryTags(entry: ChangelogProps): EntryTag[] {
const labels = entry.labels?.nodes ?? [];
return entry.product ? [{ name: entry.product }, ...labels] : labels;
}
---

<div class="changelog-toolbar">
Expand Down Expand Up @@ -69,35 +77,30 @@ function embedGithubVideos(html: string): string {
<ChangelogDot aria-hidden="true" />
</div>
<div class="changelog-entry-nav-content">
{entry.product && <span class="changelog-entry-nav-product">{entry.product}</span>}
<time class="changelog-entry-nav-date">
{new Date(entry.createdAt).toLocaleDateString('en-US', {
day: 'numeric',
month: 'long',
year: 'numeric',
})}
</time>
<h3 class="changelog-entry-nav-title">{entry.title}</h3>
<div class="changelog-entry-nav-date-row">
<time class="changelog-entry-nav-date">
{new Date(entry.createdAt).toLocaleDateString('en-US', {
day: 'numeric',
month: 'long',
year: 'numeric',
})}
</time>
{entry.labels && entry.labels.nodes.length > 0 && (
<div class="changelog-entry-card-tags">
{entry.labels.nodes.map((label) => (
<div class="changelog-entry-card-tag-row">
<span
class={`changelog-entry-card-tag changelog-entry-card-tag--${label.name.toLowerCase().replace(/[^a-z0-9]+/g, '-')}`}
>
{label.name}
</span>
{label.description && (
<span class="changelog-entry-card-tag-description">
{label.description}
</span>
)}
</div>
))}
</div>
)}
</div>
{entryTags(entry).length > 0 && (
<div class="changelog-entry-card-tags">
{entryTags(entry).map((label) => (
<div class="changelog-entry-card-tag-row">
<span
class={`changelog-entry-card-tag changelog-entry-card-tag--${label.name.toLowerCase().replace(/[^a-z0-9]+/g, '-')}`}
>
{label.name}
</span>
{label.description && (
<span class="changelog-entry-card-tag-description">{label.description}</span>
)}
</div>
))}
</div>
)}
</div>
</div>

Expand Down
20 changes: 6 additions & 14 deletions src/static/styles/components-changelog.css
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,13 @@
@apply flex min-w-0 flex-col gap-4;
}

/* Product eyebrow above the title; -mb-2 tightens the nav-content gap to pair it with the title */
.changelog-entry-nav-product {
@apply datum-text-smallcaps text-canyon-clay -mb-2 uppercase;
}

.changelog-entry-nav-title {
@apply text-midnight-fjord m-0 font-semibold xl:text-(length:--30px) xl:leading-(--42px);
}

.changelog-entry-nav-date-row {
@apply flex flex-col gap-2;
}

/* Date as the kicker above the title; -mb-2 tightens the nav-content gap to pair it with the title */
.changelog-entry-nav-date {
@apply datum-text-smallcaps text-app---dark---utility-3 uppercase;
@apply datum-text-smallcaps text-canyon-clay -mb-2 uppercase;
}

.changelog-entry-card {
Expand All @@ -176,12 +168,12 @@
.changelog-entry-card-body {
@apply datum-prose-longform text-midnight-fjord min-w-0;

& > :first-child {
@apply mt-0;
}

h2 {
@apply datum-text-2xl mt-8 mb-5 font-semibold;

&:first-child {
@apply mt-0;
}
}

h3 {
Expand Down
Loading