-
+
The data in this chart is not available to
download
-
-
+
+
The data is published under a license that
doesn't allow us to redistribute it.
{this.nonRedistributableSourceLink && (
@@ -352,6 +352,10 @@ export class DownloadModal extends React.Component {
)
}
+ @action.bound private onDismiss(): void {
+ this.manager.isDownloadModalOpen = false
+ }
+
componentDidMount(): void {
this.export()
}
@@ -360,12 +364,10 @@ export class DownloadModal extends React.Component {
return (
(this.manager.isDownloadModalOpen = false)
- )}
bounds={this.modalBounds}
+ onDismiss={this.onDismiss}
>
-
+
{this.isReady ? (
this.renderReady()
) : (
@@ -399,8 +401,10 @@ function DownloadButton(props: DownloadButtonProps): JSX.Element {
)}
-
{props.title}
-
{props.description}
+
{props.title}
+
+ {props.description}
+
diff --git a/packages/@ourworldindata/grapher/src/modal/EmbedModal.scss b/packages/@ourworldindata/grapher/src/modal/EmbedModal.scss
index 85ff5f0a033..f88795663ac 100644
--- a/packages/@ourworldindata/grapher/src/modal/EmbedModal.scss
+++ b/packages/@ourworldindata/grapher/src/modal/EmbedModal.scss
@@ -1,12 +1,12 @@
-.embedMenu {
- text-align: left;
+.embed-modal-content {
color: $dark-text;
- margin-bottom: $modal-padding;
+ margin: 0 var(--modal-padding) var(--modal-padding);
p {
- margin-bottom: 1.15em;
- margin-top: 0;
- font-size: 0.875em;
- font-weight: 500;
+ margin-bottom: 16px;
+ }
+
+ .embed-additional-elements {
+ margin-top: 16px;
}
}
diff --git a/packages/@ourworldindata/grapher/src/modal/EmbedModal.tsx b/packages/@ourworldindata/grapher/src/modal/EmbedModal.tsx
index cb5abc31378..ab6bc066943 100644
--- a/packages/@ourworldindata/grapher/src/modal/EmbedModal.tsx
+++ b/packages/@ourworldindata/grapher/src/modal/EmbedModal.tsx
@@ -19,6 +19,10 @@ interface EmbedModalProps {
@observer
export class EmbedModal extends React.Component {
+ @computed get manager(): EmbedModalManager {
+ return this.props.manager
+ }
+
@computed private get frameBounds(): Bounds {
return this.manager.frameBounds ?? DEFAULT_BOUNDS
}
@@ -34,22 +38,22 @@ export class EmbedModal extends React.Component {
return ``
}
- @computed get manager(): EmbedModalManager {
- return this.props.manager
+ @action.bound private onDismiss(): void {
+ this.manager.isEmbedModalOpen = false
}
render(): JSX.Element {
return (
(this.manager.isEmbedModalOpen = false)
- )}
bounds={this.modalBounds}
alignVertical="bottom"
+ onDismiss={this.onDismiss}
>
-
-
Paste this into any HTML page:
+
+
+ Paste this into any HTML page:
+
{this.manager.embedDialogAdditionalElements}
diff --git a/packages/@ourworldindata/grapher/src/modal/Modal.scss b/packages/@ourworldindata/grapher/src/modal/Modal.scss
index dcbaf7a7a74..ad51c3e341b 100644
--- a/packages/@ourworldindata/grapher/src/modal/Modal.scss
+++ b/packages/@ourworldindata/grapher/src/modal/Modal.scss
@@ -1,65 +1,55 @@
-$modal-padding: 1.5em;
+.modal-overlay {
+ --modal-padding: 24px;
-// the base font size for modals is 16px and on
-// smaller devices scales down to 14px.
-// it is never scaled up though.
-
-.modalOverlay {
position: absolute;
+
// -1px to hide the frame border
top: -1px;
right: -1px;
bottom: -1px;
left: -1px;
+
background-color: rgba(0, 0, 0, 0.4);
z-index: $zindex-modal;
- .modalWrapper {
+ .modal-wrapper {
position: relative;
height: 100%;
- .modalContent {
+ .modal-content {
position: absolute;
border-radius: 4px;
background: #fff;
box-shadow: 0px 4px 30px 0px rgba(0, 0, 0, 0.15);
- padding: $modal-padding;
- padding-bottom: 0;
min-height: 150px;
+
// necessary to allow modal to scroll
display: flex;
flex-direction: column;
- }
- .close-button--top-right {
- position: absolute;
- top: $modal-padding;
- right: $modal-padding;
- }
+ .close-button--top-right {
+ position: absolute;
+ top: 0;
+ right: 0;
+ margin: var(--modal-padding);
+ }
- .modalHeader {
- flex-shrink: 0; // necessary to allow modal to scroll
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 1em;
+ .modal-header {
+ flex-shrink: 0; // necessary to allow modal to scroll
- &__empty {
- margin-bottom: 4px;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: var(--modal-padding) var(--modal-padding) 16px;
}
- .modalTitle {
- text-transform: uppercase;
- color: $light-text;
- font-size: 0.75em;
- font-weight: 900;
- letter-spacing: 1.2px;
- margin: 0;
+ .modal-scrollable {
+ overflow-y: auto;
}
}
-
- .modalScrollable {
- overflow-y: auto;
- }
}
}
+
+&.GrapherComponentNarrow .modal-overlay {
+ --modal-padding: 16px;
+}
diff --git a/packages/@ourworldindata/grapher/src/modal/Modal.tsx b/packages/@ourworldindata/grapher/src/modal/Modal.tsx
index 03c2c38e0ba..0dd218a2b7b 100644
--- a/packages/@ourworldindata/grapher/src/modal/Modal.tsx
+++ b/packages/@ourworldindata/grapher/src/modal/Modal.tsx
@@ -1,7 +1,6 @@
import React from "react"
import { observer } from "mobx-react"
import { action, computed } from "mobx"
-import cx from "classnames"
import { Bounds } from "@ourworldindata/utils"
import { CloseButton } from "../closeButton/CloseButton.js"
@@ -87,20 +86,18 @@ export class Modal extends React.Component<{
}
return (
-
-
+
+
{this.showStickyHeader ? (
-
-
{this.title}
+
+
+ {this.title}
+
) : (
@@ -109,7 +106,7 @@ export class Modal extends React.Component<{
onClick={this.props.onDismiss}
/>
)}
-
diff --git a/packages/@ourworldindata/grapher/src/modal/SourcesModal.scss b/packages/@ourworldindata/grapher/src/modal/SourcesModal.scss
index 5208c6c36e2..9a636d7a837 100644
--- a/packages/@ourworldindata/grapher/src/modal/SourcesModal.scss
+++ b/packages/@ourworldindata/grapher/src/modal/SourcesModal.scss
@@ -1,15 +1,19 @@
-.SourcesModalContent {
+.sources-modal-content {
// keep in sync with variables in SourcesModal.tsx
$max-content-width: 640px;
$tab-padding: 16px;
$tab-font-size: 13px;
$tab-gap: 8px;
- padding-bottom: $modal-padding;
+ $border: #e7e7e7;
+
max-width: $max-content-width;
margin: 0 auto;
+ padding: 0 var(--modal-padding) var(--modal-padding);
- $border: #e7e7e7;
+ &.sources-modal-content--pad-top {
+ margin-top: var(--modal-padding);
+ }
.note-multiple-indicators {
margin-top: 0;
@@ -26,6 +30,7 @@
@include h1-semibold;
margin-top: 0;
margin-bottom: 8px;
+ margin-right: 8px;
color: $dark-text;
@include sm-up {
@@ -56,8 +61,8 @@
.title-fragments {
color: $light-text;
font-size: 1.25rem;
- margin-left: 8px;
}
+
a {
color: inherit;
text-decoration: underline;
@@ -153,8 +158,8 @@
margin-right: $tab-gap;
}
- .data-citation .wp-code-snippet {
- margin-bottom: 16px;
+ .data-citation__item:not(:first-of-type) {
+ margin-top: 16px;
}
.citation__paragraph {
@@ -188,7 +193,7 @@
}
}
-&.GrapherComponentSmall .SourcesModalContent {
+&.GrapherComponentSmall .sources-modal-content {
.source {
--text-small: 0.8125rem;
diff --git a/packages/@ourworldindata/grapher/src/modal/SourcesModal.tsx b/packages/@ourworldindata/grapher/src/modal/SourcesModal.tsx
index 17af8409f65..fdadfc31df4 100644
--- a/packages/@ourworldindata/grapher/src/modal/SourcesModal.tsx
+++ b/packages/@ourworldindata/grapher/src/modal/SourcesModal.tsx
@@ -23,6 +23,7 @@ import {
DataCitation,
} from "@ourworldindata/components"
import React from "react"
+import cx from "classnames"
import { action, computed } from "mobx"
import { observer } from "mobx-react"
import { faPencilAlt } from "@fortawesome/free-solid-svg-icons"
@@ -250,17 +251,24 @@ export class SourcesModal extends React.Component<
: this.renderMultipleSources()
}
+ @action.bound private onDismiss(): void {
+ this.manager.isSourcesModalOpen = false
+ }
+
render(): JSX.Element {
return (
(this.manager.isSourcesModalOpen = false)
- )}
bounds={this.modalBounds}
isHeightFixed={true}
+ onDismiss={this.onDismiss}
showStickyHeader={this.showStickyModalHeader}
>
-
+
{this.manager.isReady ? (
this.renderModalContent()
) : (
diff --git a/packages/@ourworldindata/grapher/src/sidePanel/SidePanel.scss b/packages/@ourworldindata/grapher/src/sidePanel/SidePanel.scss
index b5b195aee5c..8499c3098a1 100644
--- a/packages/@ourworldindata/grapher/src/sidePanel/SidePanel.scss
+++ b/packages/@ourworldindata/grapher/src/sidePanel/SidePanel.scss
@@ -1,15 +1,19 @@
-.SidePanel {
+.side-panel {
flex-grow: 0;
flex-shrink: 0;
border-left: 1px solid $frame-color;
overflow-y: auto;
- .title {
- text-transform: uppercase;
- color: $light-text;
- font-size: 12px;
- font-weight: 900;
- letter-spacing: 1.2px;
+ // necessary for scrolling
+ display: flex;
+ flex-direction: column;
+
+ .side-panel__header {
margin: 16px;
+ flex-shrink: 0; // necessary for scrolling
+ }
+
+ .side-panel__scrollable {
+ overflow-y: auto;
}
}
diff --git a/packages/@ourworldindata/grapher/src/sidePanel/SidePanel.tsx b/packages/@ourworldindata/grapher/src/sidePanel/SidePanel.tsx
index 1989b2b6d3c..61ef2a49cfb 100644
--- a/packages/@ourworldindata/grapher/src/sidePanel/SidePanel.tsx
+++ b/packages/@ourworldindata/grapher/src/sidePanel/SidePanel.tsx
@@ -6,7 +6,7 @@ import { Bounds } from "@ourworldindata/utils"
@observer
export class SidePanel extends React.Component<{
bounds: Bounds
- title?: string
+ title: string
children: React.ReactNode
}> {
@computed private get bounds(): Bounds {
@@ -16,16 +16,18 @@ export class SidePanel extends React.Component<{
render(): JSX.Element {
return (
- {this.props.title && (
-
{this.props.title}
- )}
- {this.props.children}
+
+ {this.props.title}
+
+
+ {this.props.children}
+
)
}
diff --git a/packages/@ourworldindata/grapher/src/slideInDrawer/SlideInDrawer.scss b/packages/@ourworldindata/grapher/src/slideInDrawer/SlideInDrawer.scss
index e9e7080bcdb..7f6f3692167 100644
--- a/packages/@ourworldindata/grapher/src/slideInDrawer/SlideInDrawer.scss
+++ b/packages/@ourworldindata/grapher/src/slideInDrawer/SlideInDrawer.scss
@@ -21,6 +21,10 @@
overflow-y: scroll;
background: white;
+ // necessary for scrolling
+ display: flex;
+ flex-direction: column;
+
.grapher-drawer-header {
position: static;
display: flex;
@@ -33,12 +37,11 @@
z-index: 1;
margin-bottom: 16px;
- .grapher-drawer-title {
- text-transform: uppercase;
- letter-spacing: 0.1em;
- color: $light-text;
- font: $bold 12px/16px $lato;
- }
+ flex-shrink: 0; // necessary for scrolling
+ }
+
+ .grapher-drawer-scrollable {
+ overflow-y: auto;
}
}
diff --git a/packages/@ourworldindata/grapher/src/slideInDrawer/SlideInDrawer.tsx b/packages/@ourworldindata/grapher/src/slideInDrawer/SlideInDrawer.tsx
index 6e046bdfce9..dbcdc03fc82 100644
--- a/packages/@ourworldindata/grapher/src/slideInDrawer/SlideInDrawer.tsx
+++ b/packages/@ourworldindata/grapher/src/slideInDrawer/SlideInDrawer.tsx
@@ -70,7 +70,7 @@ export class SlideInDrawer extends React.Component<{
@computed get drawerContents(): JSX.Element {
return (
-
+
-
+
{this.props.title}
this.toggleVisibility()} />
- {this.props.children}
+
+ {this.props.children}
+
)