Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grapher redesign: Final touchups #2738

Merged
merged 5 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ export class ActionButtons extends React.Component<{
<li style={{ width: this.downloadButtonWidth }}>
<ActionButton
label="Download"
title="Download as .png or .svg"
dataTrackNote="chart_click_download"
showLabel={this.showButtonLabels}
icon={faDownload}
Expand Down Expand Up @@ -295,7 +294,6 @@ export class ActionButtons extends React.Component<{
style={{ width: "100%" }}
>
<a
title="Explore the data"
data-track-note="chart_click_exploredata"
href={manager.canonicalUrl}
target="_blank"
Expand Down Expand Up @@ -323,7 +321,6 @@ export function ActionButton(props: {
onClick?: React.MouseEventHandler<HTMLButtonElement>
onMouseDown?: React.MouseEventHandler<HTMLButtonElement>
showLabel?: boolean
title?: string
isActive?: boolean
style?: React.CSSProperties
}): JSX.Element {
Expand All @@ -336,7 +333,6 @@ export function ActionButton(props: {
(props.isActive ? "active" : "") +
(props.showLabel ? "" : " icon-only")
}
title={props.title ?? props.label}
data-track-note={props.dataTrackNote}
onClick={(e: React.MouseEvent<HTMLButtonElement>): void => {
if (props.onClick) props.onClick(e)
Expand Down
2 changes: 1 addition & 1 deletion packages/@ourworldindata/grapher/src/core/Grapher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2689,7 +2689,7 @@ export class Grapher
}

@computed get isOnCanonicalUrl(): boolean {
if (!this.canonicalUrl || this.isInIFrame) return false
if (!this.canonicalUrl) return false
return (
getWindowUrl().pathname === Url.fromURL(this.canonicalUrl).pathname
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe("when the table has aggregates", () => {
view = Enzyme.mount(<DataTable manager={grapher} />)
})

it("renders a title row for countries and regions", () => {
it("renders a separating title row for aggregates", () => {
const titleRows = view.find("tbody .title")
expect(titleRows).toHaveLength(1)
expect(titleRows.at(0).text()).toBe("Other")
Expand Down
7 changes: 1 addition & 6 deletions packages/@ourworldindata/grapher/src/dataTable/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,7 @@ export class DataTable extends React.Component<{
}

@computed get manager(): DataTableManager {
return (
this.props.manager ?? {
table: BlankOwidTable(),
entityType: DEFAULT_GRAPHER_ENTITY_TYPE,
}
)
return this.props.manager ?? { table: BlankOwidTable() }
}

@computed private get entityType(): string {
Expand Down
4 changes: 3 additions & 1 deletion packages/@ourworldindata/grapher/src/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class Header<
const { manager } = this

// avoid linking to a grapher/data page when we're already on it
if (manager.isOnCanonicalUrl) {
if (manager.isOnCanonicalUrl && !this.manager.isInIFrame) {
return (
<h1 style={this.title.htmlStyle}>{this.title.renderHTML()}</h1>
)
Expand All @@ -144,6 +144,7 @@ export class Header<
href={manager.canonicalUrl}
target="_blank"
rel="noopener noreferrer"
data-track-note="chart_click_title"
>
<h1 style={this.title.htmlStyle}>
{this.title.renderHTML()}
Expand All @@ -159,6 +160,7 @@ export class Header<
href={manager.canonicalUrl}
target="_blank"
rel="noopener noreferrer"
data-track-note="chart_click_title"
>
{this.title.renderHTML()}
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ export interface HeaderManager {
framePaddingHorizontal?: number
framePaddingVertical?: number
isOnCanonicalUrl?: boolean
isInIFrame?: boolean
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
color: $light-text;
font-size: 0.875em;
font-weight: 500;
line-height: 1.15;
}
}

Expand Down Expand Up @@ -110,7 +111,7 @@
opacity: 0.9;
color: $light-text;
font-weight: 500;
line-height: 1.5;
line-height: 1.15;
letter-spacing: 0.14px;
}

Expand Down
Loading