-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
102 additions
and
88 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@import "./vars.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,64 +1,63 @@ | ||
@import "./vars.scss"; | ||
|
||
.header { | ||
p { | ||
margin: 0; | ||
} | ||
|
||
.info-icon { | ||
position: absolute; | ||
top: 7px; | ||
right: 7px; | ||
} | ||
|
||
.plugin-info-popup { | ||
display: flex; | ||
transform: translateX(-50px); | ||
position: absolute; | ||
background-color: white; | ||
box-shadow: 0px 2px 4px rgba(silver, 0.4); | ||
padding: 10px; | ||
border-radius: 4px; | ||
border: 1.5px solid rgba($codap-teal, 0.3); | ||
width: 150px; | ||
top: 30px; | ||
right: -20px; | ||
&.hidden { | ||
display: none; | ||
} | ||
} | ||
} | ||
$tab-height: 26px; | ||
$general-tab-width: 80px; | ||
$location-tab-width: 74px; | ||
$simulation-tab-width: 88px; | ||
$about-tab-width: 60px; | ||
|
||
.tab-container { | ||
display: flex; | ||
background-color: white; | ||
padding-top:$edge-padding + 4px; | ||
padding-left: $edge-padding; | ||
padding-right: $edge-padding; | ||
width: 100%; | ||
margin-bottom: 0; | ||
position: relative; | ||
z-index: 1; | ||
justify-content: flex-start; | ||
border-bottom:1px solid #222; | ||
height: $tab-height; | ||
display: flex; | ||
|
||
.tab { | ||
flex: 0 0 auto; | ||
position: absolute; | ||
text-align: center; | ||
padding: 10px 20px; | ||
padding: 5px 10px; | ||
cursor: pointer; | ||
color: #666; | ||
border: 1px solid $codap-teal; | ||
border-bottom: none; | ||
color: #222; | ||
border: 1px solid #222; | ||
margin-right: -1px; | ||
position: relative; | ||
border-radius: 8px 8px 0 0; | ||
background-color: #e9e9e9; | ||
border-radius: 6px 6px 0 0; | ||
background-color: white; | ||
display:inline-block; | ||
bottom:-1px; | ||
background-color: #e0e0e0; | ||
|
||
&.active { | ||
background-color: white; | ||
color: $codap-teal; | ||
border-bottom: 1px solid white; | ||
z-index: 2; | ||
font-weight: bold; | ||
z-index: 3; | ||
height: 18px; | ||
} | ||
|
||
&:hover:not(.active) { | ||
background-color: #e0e0e0; | ||
} | ||
|
||
&.location { | ||
left: $edge-padding; | ||
} | ||
|
||
&.simulation { | ||
left: $edge-padding + $location-tab-width; | ||
} | ||
|
||
&.about { | ||
left: $edge-padding + $location-tab-width + $simulation-tab-width; | ||
&.active { | ||
left: $edge-padding + $location-tab-width + $simulation-tab-width - 1px; | ||
} | ||
} | ||
} | ||
} |
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,3 +1,4 @@ | ||
$codap-teal: #177991; | ||
$codap-teal-light: #72bfca; | ||
$codap-teal-lightest: rgba(114, 191, 202, 0.25); | ||
$codap-teal-lightest: rgba(114, 191, 202, 0.25); | ||
$edge-padding: 4px; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from "react"; | ||
|
||
import "../assets/scss/about-tab.scss"; | ||
|
||
export const AboutTab: React.FC = () => { | ||
return ( | ||
<div className="about-tab"> | ||
<p>about</p> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,34 @@ | ||
import React, { useState } from "react"; | ||
import InfoIcon from "../assets/images/icon-info.svg"; | ||
import React from "react"; | ||
|
||
import "../assets/scss/header.scss"; | ||
import { TabName } from "../types"; | ||
|
||
interface IHeaderProps { | ||
activeTab: "location" | "simulation"; | ||
onTabClick: (tab: "location" | "simulation") => void; | ||
activeTab: TabName; | ||
onTabClick: (tab: TabName) => void; | ||
} | ||
|
||
export const Header: React.FC<IHeaderProps> = ({ activeTab, onTabClick }) => { | ||
const [showInfo, setShowInfo] = useState<boolean>(false); | ||
|
||
const handleInfoClick = () => { | ||
setShowInfo(!showInfo); | ||
}; | ||
|
||
return ( | ||
<> | ||
<div className="plugin-row header"> | ||
<p> | ||
How long is a day?<br /> | ||
Enter a location or coordinates to retrieve data | ||
</p> | ||
<span title="Get further information about this CODAP plugin"> | ||
<InfoIcon className="info-icon" onClick={handleInfoClick}/> | ||
</span> | ||
<div className={`plugin-info-popup ${showInfo ? "showing" : "hidden"}`}> | ||
plugin info | ||
</div> | ||
<div className="tab-container"> | ||
<div | ||
className={`tab location ${activeTab === "location" ? "active" : ""}`} | ||
onClick={() => onTabClick("location")} | ||
> | ||
Location | ||
</div> | ||
<div | ||
className={`tab simulation ${activeTab === "simulation" ? "active" : ""}`} | ||
onClick={() => onTabClick("simulation")} | ||
> | ||
Simulation | ||
</div> | ||
<hr /> | ||
<div className="tab-container"> | ||
<div | ||
className={`tab ${activeTab === "location" ? "active" : ""}`} | ||
onClick={() => onTabClick("location")} | ||
> | ||
Location | ||
</div> | ||
<div | ||
className={`tab ${activeTab === "simulation" ? "active" : ""}`} | ||
onClick={() => onTabClick("simulation")} | ||
> | ||
Simulation | ||
</div> | ||
<div | ||
className={`tab about ${activeTab === "about" ? "active" : ""}`} | ||
onClick={() => onTabClick("about")} | ||
> | ||
About | ||
</div> | ||
</> | ||
</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
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