-
-
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) add CloseButton component
- Loading branch information
1 parent
fb54f50
commit 36ba513
Showing
11 changed files
with
169 additions
and
202 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
packages/@ourworldindata/grapher/src/closeButton/CloseButton.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,45 @@ | ||
.close-button { | ||
$light-stroke: #e7e7e7; | ||
|
||
$active-fill: #dbe5f0; | ||
$hover-fill: #f2f2f2; | ||
|
||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
|
||
position: relative; | ||
height: 32px; | ||
width: 32px; | ||
padding: 7px; | ||
|
||
color: $light-text; | ||
background: white; | ||
border: 1px solid $light-stroke !important; | ||
border-radius: 50%; | ||
|
||
&:hover { | ||
background: $hover-fill; | ||
cursor: pointer; | ||
|
||
&:not(.active) { | ||
color: $dark-text; | ||
} | ||
} | ||
|
||
&.active, | ||
&:active { | ||
background: $active-fill; | ||
border: 1px solid $active-fill; | ||
} | ||
|
||
&.active { | ||
cursor: default; | ||
color: $active-text; | ||
} | ||
|
||
svg { | ||
height: 14px; | ||
width: 14px; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
packages/@ourworldindata/grapher/src/closeButton/CloseButton.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,18 @@ | ||
import React from "react" | ||
import cx from "classnames" | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome/index.js" | ||
import { faXmark } from "@fortawesome/free-solid-svg-icons" | ||
|
||
export function CloseButton({ | ||
onClick, | ||
className, | ||
}: { | ||
onClick: React.MouseEventHandler<HTMLButtonElement> | ||
className?: string | ||
}) { | ||
return ( | ||
<button className={cx("close-button", className)} onClick={onClick}> | ||
<FontAwesomeIcon icon={faXmark} /> | ||
</button> | ||
) | ||
} |
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
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.