-
-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔨 (grapher) refactor modals and entity selector (#3490)
[Cycle 2024.2: Entity selector](#3349) | [Designs](https://www.figma.com/file/X5mOEX8zULS6qyHocUYdmh/Grapher-UI?type=design&node-id=2523%3A6266&mode=design&t=7edFp79OOjz6RENz-1) ## Background - Modals used to come with a sticky header with a title and a close button, making the content area scrollable by default. - This was convenient when our modals were relatively simple but started breaking down first for the Sources modal (where we need a sticky header on smaller screens only) and then for the entity selector (where we have some more sticky content on the top and bottom) - For the entity selector in particular, making the entity selector work with the current `<Modal />` implementation led to a number of bugs that were difficult to get rid of (1px of text surfacing above the search input, the scrollbar hidden behind the footer) ## Summary - Makes the `<Modal />`, `<SlideInDrawer />` and `<SidePanel />` into unopinionated container components that render their children – and nothing else - Content that is rendered into a modal/drawer/panel is then responsible for making itself scrollable (if necessary) ## SVG tester The SVG tester fails due to the changes in #3373
- Loading branch information
1 parent
e186b8e
commit a484995
Showing
23 changed files
with
414 additions
and
431 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/@ourworldindata/grapher/src/core/OverlayHeader.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.overlay-header { | ||
--padding: var(--modal-padding, 16px); | ||
|
||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
padding: var(--padding) var(--padding) 16px; | ||
|
||
button { | ||
margin-left: 8px; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
packages/@ourworldindata/grapher/src/core/OverlayHeader.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from "react" | ||
import cx from "classnames" | ||
import { CloseButton } from "../closeButton/CloseButton.js" | ||
|
||
export function OverlayHeader({ | ||
title, | ||
onDismiss, | ||
className, | ||
}: { | ||
title: string | ||
onDismiss?: () => void | ||
className?: string | ||
}): JSX.Element { | ||
return ( | ||
<div className={cx("overlay-header", className)}> | ||
<h2 className="grapher_h5-black-caps grapher_light">{title}</h2> | ||
{onDismiss && <CloseButton onClick={onDismiss} />} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.