Skip to content

Commit

Permalink
✨ all-charts block code review enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
ikesau committed Feb 4, 2025
1 parent 36da2f2 commit 26ea232
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 29 deletions.
3 changes: 2 additions & 1 deletion baker/siteRenderers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,8 @@ ${dataInsights
homepageMetadata: get(post, "homepageMetadata", {}),
latestWorkLinks: get(post, "latestWorkLinks", []),
linkedChartViews: get(post, "linkedChartViews", {}),
tags: get(post, "tags", []) ?? [],
// lodash doesn't use fallback when value is null
tags: post.tags ?? [],
}}
>
<AtomArticleBlocks blocks={post.content.body} />
Expand Down
3 changes: 2 additions & 1 deletion site/gdocs/OwidGdoc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ export function OwidGdoc({
homepageMetadata: get(props, "homepageMetadata", {}),
latestWorkLinks: get(props, "latestWorkLinks", []),
linkedChartViews: get(props, "linkedChartViews", {}),
tags: get(props, "tags", []) ?? [],
// lodash doesn't use fallback when value is null
tags: props.tags ?? [],
}}
>
<DocumentContext.Provider value={{ isPreviewing }}>
Expand Down
18 changes: 1 addition & 17 deletions site/gdocs/components/AllCharts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
h1.h1-semibold {
margin: 0;
flex: 1 1 0%;
.deep-link {
// Any value smaller than -16 causes the h1 to wrap in Firefox
margin-left: -16px;
}
}

display: flex;
Expand All @@ -14,20 +10,8 @@
align-items: center;
margin-bottom: 40px;

.owid-button {
line-height: 40px;
text-align: center;
padding: 0 24px;
height: 40px;
flex-shrink: 0;
.owid-btn {
align-self: start;
background-color: $vermillion;
svg {
margin-left: 8px;
}
&:hover {
background-color: $accent-vermillion;
}
@include sm-only {
order: 3;
margin-top: 24px;
Expand Down
15 changes: 5 additions & 10 deletions site/gdocs/components/AllCharts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ import {
} from "@ourworldindata/utils"
import { AttachmentsContext } from "../AttachmentsContext.js"
import { RelatedCharts } from "../../blocks/RelatedCharts.js"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { faArrowRight } from "@fortawesome/free-solid-svg-icons"
import { BAKED_BASE_URL } from "../../../settings/clientSettings.js"
import { Button } from "@ourworldindata/components"

type AllChartsProps = EnrichedBlockAllCharts & {
className?: string
Expand Down Expand Up @@ -70,15 +69,11 @@ export function AllCharts(props: AllChartsProps) {
href={`#${ALL_CHARTS_ID}`}
/>
</h1>
<a
className="owid-button"
<Button
theme="solid-vermillion"
text="See all charts on this topic"
href={`${urljoin(BAKED_BASE_URL, `/data`, firstTagDataCatalogQueryString)}`}
>
<span className="body-3-medium">
See all charts on this topic
<FontAwesomeIcon icon={faArrowRight} />
</span>
</a>
/>
<RelatedCharts
showKeyChartsOnly={true}
charts={sortedRelatedCharts}
Expand Down

0 comments on commit 26ea232

Please sign in to comment.