-
-
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.
🎉 (entity selector) sort by name or value
- Loading branch information
1 parent
937f3f1
commit 7ea0597
Showing
16 changed files
with
657 additions
and
202 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
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
86 changes: 86 additions & 0 deletions
86
packages/@ourworldindata/grapher/src/controls/Dropdown.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,86 @@ | ||
.grapher-dropdown { | ||
$option-checkmark: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOSIgdmlld0JveD0iMCAwIDEyIDkiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0xMS4wMTU2IDAuOTg0Mzc1QzExLjMyMDMgMS4yNjU2MiAxMS4zMjAzIDEuNzU3ODEgMTEuMDE1NiAyLjAzOTA2TDUuMDE1NjIgOC4wMzkwNkM0LjczNDM4IDguMzQzNzUgNC4yNDIxOSA4LjM0Mzc1IDMuOTYwOTQ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MjAwMC9zdmciPgo8cGF0aCBkPSJNNy41MTU2MiAxLjI4OTA2TDQuNTM5MDYgNC4yODkwNkM0LjM3NSA0LjQyOTY5IDQuMTg3NSA0LjUgNCA0LjVDMy43ODkwNiA0LjUgMy42MDE1NiA0LjQyOTY5IDMuNDYwOTQgNC4yODkwNkwwLjQ4NDM3NSAxLjI4OTA2QzAuMjUgMS4wNzgxMiAwLjE3OTY4OCAwLjc1IDAuMjk2ODc1IDAuNDY4NzVDMC40MTQwNjIgMC4xODc1IDAuNjk1MzEyIDAgMSAwSDYuOTc2NTZDNy4yODEyNSAwIDcuNTM5MDYgMC4xODc1IDcuNjU2MjUgMC40Njg3NUM3Ljc3MzQ0IDAuNzUgNy43MjY1NiAxLjA3ODEyIDcuNTE1NjIgMS4yODkwNloiIGZpbGw9IiM1QjVCNUIiLz4KPC9zdmc+Cg=="; | ||
|
||
$medium: 400; | ||
$lato: $sans-serif-font-stack; | ||
|
||
$light-stroke: #e7e7e7; | ||
$active-stroke: #a4b6ca; | ||
|
||
$active-fill: #dbe5f0; | ||
$hover-fill: #f2f2f2; | ||
$selected-fill: #c7ced7; | ||
|
||
$light-text: #858585; | ||
|
||
font: $medium 13px/16px $lato; | ||
|
||
.control { | ||
min-height: auto; | ||
font: $medium 13px/16px $lato; | ||
letter-spacing: 0.01em; | ||
display: flex; | ||
align-items: center; | ||
border: 1px solid $light-stroke; | ||
border-radius: 4px; | ||
padding: 7px; | ||
color: $dark-text; | ||
|
||
&:hover { | ||
background: $hover-fill; | ||
cursor: pointer; | ||
} | ||
|
||
&:after { | ||
content: " "; | ||
background: url($menu-caret-down) no-repeat center; | ||
width: 16px; | ||
height: 16px; | ||
} | ||
|
||
&.active { | ||
border-color: $active-stroke; | ||
&:after { | ||
background: url($menu-caret-up) no-repeat center; | ||
} | ||
} | ||
} | ||
|
||
.menu { | ||
margin-top: 3px; | ||
border-radius: 4px; | ||
background: white; | ||
box-shadow: 0px 4px 40px 0px rgba(0, 0, 0, 0.15); | ||
z-index: $zindex-controls-popup; | ||
|
||
.option { | ||
padding: 8px 18px; | ||
&:hover { | ||
cursor: pointer; | ||
background: $hover-fill; | ||
} | ||
&:active, | ||
&.active { | ||
color: $active-text; | ||
background: $active-fill; | ||
} | ||
&.active { | ||
position: relative; | ||
&:hover { | ||
background: $selected-fill; | ||
} | ||
&:after { | ||
content: " "; | ||
background: url($option-checkmark) no-repeat; | ||
width: 12px; | ||
height: 9px; | ||
position: absolute; | ||
right: 18px; | ||
bottom: 11px; | ||
} | ||
} | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
packages/@ourworldindata/grapher/src/controls/Dropdown.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,26 @@ | ||
import React from "react" | ||
import Select, { Props } from "react-select" | ||
|
||
export function Dropdown(props: Props): React.JSX.Element { | ||
return ( | ||
<Select | ||
className="grapher-dropdown" | ||
menuPlacement="bottom" | ||
components={{ | ||
IndicatorSeparator: null, | ||
DropdownIndicator: null, | ||
}} | ||
isSearchable={false} | ||
unstyled={true} | ||
isMulti={false} | ||
classNames={{ | ||
control: (state) => | ||
state.menuIsOpen ? "active control" : "control", | ||
option: (state) => | ||
state.isSelected ? "active option" : "option", | ||
menu: () => "menu", | ||
}} | ||
{...props} | ||
/> | ||
) | ||
} |
94 changes: 6 additions & 88 deletions
94
packages/@ourworldindata/grapher/src/controls/MapProjectionMenu.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 |
---|---|---|
@@ -1,95 +1,13 @@ | ||
.map-projection-menu { | ||
$option-checkmark: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOSIgdmlld0JveD0iMCAwIDEyIDkiIGZ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DY5QzAuMTc5Njg4IDQuMjczNDQgMC4yNSAzLjk0NTMxIDAuNDYwOTM4IDMuNzM0MzhaIiBmaWxsPSIjNUI1QjVCIi8+Cjwvc3ZnPg=="; | ||
$menu-caret-down: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOCIgaGVpZ2h0PSI1IiB2aWV3Qm94PSIwIDAgOCA1IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNNy41MTU2MiAxLjI4OTA2TDQuNTM5MDYgNC4yODkwNkM0LjM3NSA0LjQyOTY5IDQuMTg3NSA0LjUgNCA0LjVDMy43ODkwNiA0LjUgMy42MDE1NiA0LjQyOTY5IDMuNDYwOTQgNC4yODkwNkwwLjQ4NDM3NSAxLjI4OTA2QzAuMjUgMS4wNzgxMiAwLjE3OTY4OCAwLjc1IDAuMjk2ODc1IDAuNDY4NzVDMC40MTQwNjIgMC4xODc1IDAuNjk1MzEyIDAgMSAwSDYuOTc2NTZDNy4yODEyNSAwIDcuNTM5MDYgMC4xODc1IDcuNjU2MjUgMC40Njg3NUM3Ljc3MzQ0IDAuNzUgNy43MjY1NiAxLjA3ODEyIDcuNTE1NjIgMS4yODkwNloiIGZpbGw9IiM1QjVCNUIiLz4KPC9zdmc+Cg=="; | ||
|
||
$medium: 400; | ||
$lato: $sans-serif-font-stack; | ||
|
||
$light-stroke: #e7e7e7; | ||
$active-stroke: #a4b6ca; | ||
|
||
$active-fill: #dbe5f0; | ||
$hover-fill: #f2f2f2; | ||
$selected-fill: #c7ced7; | ||
|
||
$light-text: #858585; | ||
|
||
font: $medium 13px/16px $lato; | ||
|
||
.control { | ||
min-height: auto; | ||
min-width: 150px; | ||
font: $medium 13px/16px $lato; | ||
letter-spacing: 0.01em; | ||
display: flex; | ||
align-items: center; | ||
border: 1px solid $light-stroke; | ||
border-radius: 4px; | ||
padding: 7px; | ||
color: $dark-text; | ||
|
||
&:hover { | ||
background: $hover-fill; | ||
cursor: pointer; | ||
} | ||
|
||
&:after { | ||
content: " "; | ||
background: url($menu-caret-down) no-repeat center; | ||
width: 16px; | ||
height: 16px; | ||
} | ||
|
||
&.active { | ||
border-color: $active-stroke; | ||
&:after { | ||
background: url($menu-caret-up) no-repeat center; | ||
} | ||
} | ||
} | ||
|
||
.menu { | ||
margin-top: 3px; | ||
border-radius: 4px; | ||
background: white; | ||
box-shadow: 0px 4px 40px 0px rgba(0, 0, 0, 0.15); | ||
z-index: $zindex-controls-popup; | ||
|
||
&:before { | ||
display: inline-block; | ||
content: "Zoom to selection"; | ||
font: 700 12px/16px $lato; | ||
color: $light-text; | ||
padding: 8px 18px; | ||
} | ||
|
||
.option { | ||
padding: 8px 18px; | ||
&:hover { | ||
cursor: pointer; | ||
background: $hover-fill; | ||
} | ||
&:active, | ||
&.active { | ||
color: $active-text; | ||
background: $active-fill; | ||
} | ||
&.active { | ||
position: relative; | ||
&:hover { | ||
background: $selected-fill; | ||
} | ||
&:after { | ||
content: " "; | ||
background: url($option-checkmark) no-repeat; | ||
width: 12px; | ||
height: 9px; | ||
position: absolute; | ||
right: 18px; | ||
bottom: 11px; | ||
} | ||
} | ||
} | ||
.menu:before { | ||
display: inline-block; | ||
content: "Zoom to selection"; | ||
font: 700 12px/16px $lato; | ||
color: $light-text; | ||
padding: 8px 18px; | ||
} | ||
} |
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
Oops, something went wrong.