Skip to content

Commit 2cf2029

Browse files
committed
add changelog page
1 parent 21641ee commit 2cf2029

File tree

5 files changed

+141
-23
lines changed

5 files changed

+141
-23
lines changed

src/components/ChangelogSnippet/ChangelogCard.astro

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import type { ChangelogItem } from "./types"
55
66
interface Props {
77
item: ChangelogItem
8+
showBorder?: boolean
89
}
910
10-
const { item } = Astro.props
11+
const { item, showBorder = true } = Astro.props
1112
1213
// Format the date
1314
const formatDate = (dateString: string) => {
@@ -22,14 +23,14 @@ const formatDate = (dateString: string) => {
2223
const formattedDate = formatDate(item["date-of-release"])
2324
---
2425

25-
<div class={styles.cardWrapper} data-expandable="wrapper">
26+
<div class={showBorder ? styles.cardWrapperWithBorder : styles.cardWrapper} data-expandable="wrapper">
2627
<div class={styles.card} data-expandable="card">
2728
<div class={styles.header}>
2829
<div class={styles.metaSection}>
29-
<Typography variant="body-semi">
30+
<Typography variant="body-semi" className={styles.changelogType}>
3031
{item.type}
3132
</Typography>
32-
<Typography variant="body-s" color="muted">
33+
<Typography variant="body-s" color="muted" className={styles.date}>
3334
{formattedDate}
3435
</Typography>
3536
</div>
@@ -46,7 +47,7 @@ const formattedDate = formatDate(item["date-of-release"])
4647
</Typography>
4748

4849
<div class={styles.descriptionContent}>
49-
{item["text-description"] && <div class="description" set:html={item["text-description"]} />}
50+
{item["text-description"] && <div class={styles.description} set:html={item["text-description"]} />}
5051
</div>
5152
</div>
5253
</div>

src/components/ChangelogSnippet/ChangelogCard.module.css

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,43 @@
1-
/* Card Wrapper */
1+
/* Card Wrapper used in Changelog page */
22
.cardWrapper {
33
max-height: 400px;
44
overflow: hidden;
5-
transition: max-height 0.5s ease;
5+
transition: all 0.5s ease;
66
position: relative;
7+
8+
&:hover {
9+
background-color: var(--gray-50);
10+
}
11+
}
12+
13+
.cardWrapper,
14+
.cardWrapperWithBorder {
15+
& .card {
16+
padding: var(--space-6x);
17+
}
18+
}
19+
20+
/* Used on individual pages like CCIP/DataFeeds */
21+
.cardWrapperWithBorder {
722
border: 1px solid var(--border);
23+
24+
&:hover {
25+
background-color: var(--muted);
26+
}
827
}
928

1029
/* Card Container */
1130
.card {
1231
display: flex;
1332
gap: 82px;
14-
padding: var(--space-6x);
1533
}
1634

17-
.cardWrapper.expanded .card {
35+
.cardWrapperWithBorder.expanded .card {
1836
-webkit-mask-image: none;
1937
mask-image: none;
2038
}
2139

22-
.cardWrapper:hover {
23-
background-color: var(--muted);
24-
40+
.cardWrapperWithBorder:hover {
2541
& .contentFooter {
2642
background: linear-gradient(to top, var(--muted) 50%, transparent);
2743
}
@@ -54,11 +70,11 @@
5470

5571
.description p {
5672
margin: 0;
57-
color: var(--foreground);
73+
color: var(--muted-foreground);
5874
}
5975

6076
.description a {
61-
color: var(--color-blue-600);
77+
color: var(--link);
6278
text-decoration: none;
6379
}
6480

@@ -68,7 +84,7 @@
6884

6985
.header {
7086
display: flex;
71-
width: 150px;
87+
width: 160px;
7288
}
7389

7490
.content {
@@ -119,16 +135,28 @@
119135
transition: transform 0.3s ease;
120136
}
121137

122-
@media (max-width: 768px) {
138+
@media screen and (max-width: 425px) {
123139
.card {
124-
padding: var(--space-4x);
125140
flex-direction: column;
141+
}
142+
143+
.changelogType {
144+
font-size: 14px;
145+
}
146+
147+
.metaSection {
148+
gap: 0 !important;
149+
}
150+
}
151+
152+
@media screen and (max-width: 768px) {
153+
.card {
154+
padding: var(--space-4x);
126155
gap: var(--space-4x);
127156
}
128157

129158
.header {
130159
gap: var(--space-3x);
131-
width: 100%;
132160
}
133161

134162
.metaSection {

src/components/ChangelogSnippet/ChangelogSnippet.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ if (appId && apiKey) {
5555
Changelog
5656
</Typography>
5757

58-
<a href="https://dev.chain.link/changelog" class={styles.arrow}>
58+
<a href="/changelog" class={styles.arrow}>
5959
<SvgArrowRight2 height={12} width={12} />
6060
</a>
6161
</header>

src/components/ChangelogSnippet/README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
The ChangelogSnippet component displays the most recent changelog entry for a specific product or topic. It searches through changelog entries and shows the latest update in a card format with an expandable description.
66

7+
## Notes
8+
9+
On pages like "CCIP" (individual product pages), the changelog card has a border and has slightly different styling than the component shown on the Changelog page. This component has no border and some different hover effects. This styling is controlled by the "showBorder" prop. The showBorder prop when set to true (true is the default value) is what you see on individual product pages. This will be the default styling when using the changelog components. On the Changelog page you can see the styling when showBorder is set to false.
10+
711
## How to Use It
812

913
Import the component into your MDX file and provide a search query:
@@ -16,9 +20,10 @@ import ChangelogSnippet from "@components/ChangelogSnippet/ChangelogSnippet.astr
1620

1721
## Props
1822

19-
| Prop | Type | Required | Description |
20-
| ------- | ------ | -------- | ------------------------------------------------------------------------------------------- |
21-
| `query` | string | Yes | The search term used to find relevant changelog entries (e.g., "ccip", "vrf", "automation") |
23+
| Prop | Type | Required | Description |
24+
| ------------ | ------- | -------- | ------------------------------------------------------------------------------------------- |
25+
| `query` | string | Yes | The search term used to find relevant changelog entries (e.g., "ccip", "vrf", "automation") |
26+
| `showBorder` | boolean | No | Whether to show a border around the card. Defaults to true. |
2227

2328
## Complete Example
2429

src/pages/changelog.astro

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,94 @@
11
---
22
import BaseLayout from "~/layouts/BaseLayout.astro"
33
import * as CONFIG from "../config"
4+
import { Typography } from "@chainlink/blocks"
45
6+
import { getSecret } from "astro:env/server"
7+
import { searchClient, SearchClient } from "@algolia/client-search"
8+
import { ChangelogItem } from "~/components/ChangelogSnippet/types"
9+
import ChangelogCard from "~/components/ChangelogSnippet/ChangelogCard.astro"
510
const formattedContentTitle = `${CONFIG.PAGE.titleFallback} | ${CONFIG.SITE.title}`
11+
12+
const appId = getSecret("ALGOLIA_APP_ID")
13+
const apiKey = getSecret("PUBLIC_ALGOLIA_SEARCH_PUBLIC_API_KEY")
14+
15+
let client: SearchClient
16+
let logs: ChangelogItem[] | undefined = undefined
17+
18+
// Initialize client if appId and apiKey are available to avoid needing to update
19+
// the github actions with the new keys (satisfies linkcheck-internal)
20+
if (appId && apiKey) {
21+
client = searchClient(appId, apiKey)
22+
23+
const req = await client.search({
24+
requests: [
25+
{
26+
indexName: "Changelog",
27+
restrictSearchableAttributes: ["topic"],
28+
},
29+
],
30+
})
31+
32+
const firstResult = req.results[0]
33+
const results = "hits" in firstResult ? (firstResult.hits as ChangelogItem[]) : []
34+
35+
// logs are returned sorted by created_at DESC
36+
logs = results
37+
}
638
---
739

840
<BaseLayout title={formattedContentTitle}>
9-
<main></main>
41+
<main class="wrapper">
42+
<header class="header">
43+
<Typography className="tag">Changelog</Typography>
44+
<Typography variant="h1" className="title">Never miss an update</Typography>
45+
</header>
46+
47+
<section class="changelog-list">
48+
{logs?.map((log) => <ChangelogCard showBorder={false} item={log} />)}
49+
</section>
50+
</main>
1051
</BaseLayout>
52+
53+
<style is:global>
54+
.changelog-list {
55+
display: flex;
56+
flex-direction: column;
57+
gap: 60px;
58+
}
59+
.wrapper {
60+
max-width: 1064px;
61+
width: 100%;
62+
margin: 0 auto;
63+
padding: 100px var(--space-6x);
64+
}
65+
66+
.tag {
67+
font-weight: 500;
68+
letter-spacing: 1.28px;
69+
color: var(--grey-600);
70+
margin-bottom: var(--space-4x);
71+
text-transform: uppercase;
72+
}
73+
74+
.header {
75+
margin-bottom: var(--space-16x);
76+
}
77+
78+
@media screen and (max-width: 768px) {
79+
.tag {
80+
font-size: 12px;
81+
margin-bottom: var(--space-3x);
82+
}
83+
.title {
84+
font-size: 2rem;
85+
}
86+
.header {
87+
margin-bottom: var(--space-10x);
88+
}
89+
90+
.wrapper {
91+
padding: 60px var(--space-6x);
92+
}
93+
}
94+
</style>

0 commit comments

Comments
 (0)