Skip to content

Commit

Permalink
cleanup: remove relatedData section from data pages
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelgerber committed Aug 13, 2024
1 parent 08d8eed commit 730bc51
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 211 deletions.
1 change: 0 additions & 1 deletion baker/DatapageHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export const getDatapageDataV2 = async (
dateRange: variableMetadata.timespan ?? "",
lastUpdated: lastUpdated,
nextUpdate: nextUpdate,
relatedData: [],
allCharts: [],
relatedResearch: [],
source: variableMetadata.source,
Expand Down
22 changes: 0 additions & 22 deletions packages/@ourworldindata/types/src/gdocTypes/Datapage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export interface DataPageDataV2 {
lastUpdated: string
nextUpdate?: string
relatedResearch: DataPageRelatedResearch[]
relatedData: DataPageRelatedData[]
allCharts: RelatedChart[] // Chart slugs
source: OwidSource | undefined
origins: OwidOrigin[]
Expand All @@ -56,15 +55,6 @@ export interface DataPageRelatedResearch {
tags: string[]
}

export interface DataPageRelatedData {
type?: string
title: string
source?: string
url: string
content?: string
featured?: boolean
}

// This gives us a typed object we can use to validate datapage JSON files at runtime (see
// Value.Check() and Value.Errors() below), as well as a type that we can use
// for typechecking at compile time (see "type DataPageJson" below).
Expand Down Expand Up @@ -100,18 +90,6 @@ export const DataPageJsonTypeObject = Type.Object(
})
)
),
relatedData: Type.Optional(
Type.Array(
Type.Object({
type: Type.Optional(Type.String()),
title: Type.String(),
source: Type.Optional(Type.String()),
url: Type.String(),
content: Type.Optional(Type.String()),
featured: Type.Optional(Type.Boolean()),
})
)
),
allCharts: Type.Optional(
Type.Array(
Type.Object({
Expand Down
1 change: 0 additions & 1 deletion packages/@ourworldindata/types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ export {
type DataPageParseError,
type DataPageV2ContentFields,
type DataPageDataV2,
type DataPageRelatedData,
type DataPageRelatedResearch,
type PrimaryTopic,
type FaqLink,
Expand Down
86 changes: 0 additions & 86 deletions site/DataPageContent.scss
Original file line number Diff line number Diff line change
Expand Up @@ -164,92 +164,6 @@
color: $blue-50;
}

.related-data__title {
@include datapage-section-title;
@include lg-up {
margin-bottom: 0px;
}
}

.related-data__items--two-cols {
@include sm-only {
overflow-x: auto;
grid-template-columns: repeat(6, 80px);
padding-bottom: 16px;
}
}

.related-data__category--grid {
display: grid;
height: fit-content;
row-gap: 24px;
}

.related-data__category--columns {
@include sm-up {
columns: 2;
column-gap: var(--grid-gap);
}
.related-data-item {
margin-bottom: 24px;
display: block;
break-inside: avoid;
&:last-child {
margin-bottom: 0;
}
}
}

.related-data-item--medium {
padding: 24px;
background-color: $blue-10;
transition: background-color 0.1s;
&:hover {
background-color: $blue-20;
}
.related-data-item__title {
@include h3-bold;
margin: 0;
color: $blue-90;
}
}

.related-data-item--small {
.related-data-item__title {
@include h4-semibold;
margin: 0;
color: $blue-90;
}

&:hover .related-data-item__title {
text-decoration: underline;
}

.related-data-item__source {
@include body-3-medium;
color: $blue-60;
margin-top: 4px;
}
}

.related-data-item__type {
@include overline-black-caps;
color: $blue-50;
margin-bottom: 8px;
}

.related-data-item__source {
@include h3-bold;
color: $blue-50;
margin: 0;
}

.related-data-item__content {
@include body-3-medium;
color: $blue-60;
margin-top: 8px;
}

.section-wrapper__related-charts {
.related-charts {
margin-bottom: 0;
Expand Down
101 changes: 0 additions & 101 deletions site/DataPageV2Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
} from "@ourworldindata/utils"
import { AttachmentsContext, DocumentContext } from "./gdocs/OwidGdoc.js"
import StickyNav from "./blocks/StickyNav.js"
import cx from "classnames"
import { DebugProvider } from "./gdocs/DebugContext.js"
import { BAKED_BASE_URL } from "../settings/clientSettings.js"
import Image from "./gdocs/components/Image.js"
Expand Down Expand Up @@ -103,7 +102,6 @@ export const DataPageV2Content = ({
text: "Research & Writing",
target: "#research-and-writing",
},
{ text: "Related Data", target: "#related-data" },
{ text: "All Charts", target: "#all-charts" },
{ text: "FAQs", target: "#faqs" },
{
Expand All @@ -113,17 +111,6 @@ export const DataPageV2Content = ({
{ text: "Reuse This Work", target: "#" + REUSE_THIS_WORK_SECTION_ID },
]

const hasRelatedDataFeatured = datapageData.relatedData?.some(
(data) => data.featured
)
const hasRelatedDataNonFeatured = datapageData.relatedData?.some(
(data) => !data.featured
)
const relatedDataCategoryClasses = `related-data__category ${
hasRelatedDataFeatured && hasRelatedDataNonFeatured
? "related-data__category--grid span-cols-4 span-lg-cols-6 span-sm-cols-3"
: "related-data__category--columns span-cols-8 span-lg-cols-12"
} `
const relatedResearchCandidates = datapageData.relatedResearch
const relatedResearch =
relatedResearchCandidates.length > 3 &&
Expand Down Expand Up @@ -249,94 +236,6 @@ export const DataPageV2Content = ({
</div>
</div>
)}
{!!datapageData.relatedData?.length && (
<div className="section-wrapper grid">
<h2
className="related-data__title span-cols-3 span-lg-cols-12"
id="related-data"
>
Related data
</h2>
<div
className={cx(
"related-data__items",
{
"related-data__items--two-cols":
hasRelatedDataFeatured &&
hasRelatedDataNonFeatured,
},
"grid",
"grid-cols-9",
"grid-lg-cols-12",
"span-cols-9",
"span-lg-cols-12"
)}
>
{hasRelatedDataFeatured && (
<div
className={
relatedDataCategoryClasses
}
>
{datapageData.relatedData
.filter((data) => data.featured)
.map((data) => (
<a
href={data.url}
key={data.url}
className="related-data-item related-data-item--medium col-start-1 col-end-limit"
>
{data.type && (
<div className="related-data-item__type">
{data.type}
</div>
)}
<h3 className="related-data-item__title">
{data.title}
</h3>
{data.source && (
<div className="related-data-item__source">
{data.source}
</div>
)}
<div className="related-data-item__content">
{data.content}
</div>
</a>
))}
</div>
)}
{hasRelatedDataNonFeatured && (
<div
className={
relatedDataCategoryClasses
}
>
{datapageData.relatedData
.filter(
(data) => !data.featured
)
.map((data) => (
<a
href={data.url}
key={data.url}
className="related-data-item related-data-item--small col-start-1 col-end-limit"
>
<h4 className="related-data-item__title">
{data.title}
</h4>
{data.source && (
<div className="related-data-item__source">
{data.source}
</div>
)}
</a>
))}
</div>
)}
</div>
</div>
)}
{datapageData.allCharts &&
datapageData.allCharts.length > 0 ? (
<div className="section-wrapper section-wrapper__related-charts">
Expand Down

0 comments on commit 730bc51

Please sign in to comment.