Skip to content

Commit

Permalink
✨ add link to data insight titles on index page
Browse files Browse the repository at this point in the history
  • Loading branch information
ikesau committed Jan 16, 2025
1 parent e21c07a commit 59953a4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions site/DataInsightsIndexPageContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export const DataInsightsIndexPageContent = (
<DataInsightBody
key={dataInsight.id}
anchor={id}
shouldLinkTitle
{...dataInsight}
/>
)
Expand Down
10 changes: 10 additions & 0 deletions site/gdocs/pages/DataInsight.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@
padding: 24px;
margin-bottom: 30px;

.data-insight-heading-link {
color: $blue-90;
&:hover {
text-decoration: underline;
}
}

h1 {
margin-top: 0;
margin-bottom: 8px;
Expand Down Expand Up @@ -86,6 +93,9 @@
display: flex;
align-items: center;
gap: 8px;
&:hover {
text-decoration: underline;
}
}

.data-insight-blocks {
Expand Down
17 changes: 16 additions & 1 deletion site/gdocs/pages/DataInsight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ export const DataInsightBody = (
props: OwidGdocDataInsightInterface & {
anchor?: string
publishedAt: Date | string | null
shouldLinkTitle?: boolean
}
) => {
const shouldLinkTitle = props.shouldLinkTitle
const publishedAt = props.publishedAt ? new Date(props.publishedAt) : null
return (
<div className="grid grid-cols-12-full-width span-cols-14">
Expand All @@ -124,7 +126,20 @@ export const DataInsightBody = (
day: "2-digit",
}}
/>
<h1 className="display-3-semibold">{props.content.title}</h1>
{shouldLinkTitle ? (
<a
href={`${BAKED_BASE_URL}/data-insights/${props.slug}`}
className="data-insight-heading-link"
>
<h1 className="display-3-semibold">
{props.content.title}
</h1>
</a>
) : (
<h1 className="display-3-semibold">
{props.content.title}
</h1>
)}
<div className="data-insight-authors body-3-medium">
{props.content.authors.map((author, index) => (
<LinkedAuthor
Expand Down

0 comments on commit 59953a4

Please sign in to comment.