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

added toggle button(Issue #151) #181

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions client/src/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,15 @@ const ConnectionButton = (props) => {
}

const Header = () => {
const [toggled, setToggled] = useState(false);
return (
<NavContainer>
<h1 className="heading" style={{ "margin-right": "25rem" }}>TJUAV Ground Station</h1>
<Row width="50%" style={{ "margin-top": "0.5em", "margin-right": "-5em" }}>
<Link href="/">Flight Data</Link>
<button className={`toggle-btn ${toggled ? "toggled": ""}`} onClick={() => setToggled(!toggled)}>
<div className="thumb"></div>
</button>
<Link href="/params">Params</Link>
<Link href="/submissions">Submissions</Link>
</Row>
Expand Down
41 changes: 41 additions & 0 deletions client/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,44 @@ body {
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace;
}


.toggle-btn
{
border: radius 99px;
width: 50px;
height: 28px;
transition: background-color 0.1s ease, border-color 0.2s ease;
cursor: pointer;
box-shadow: 1px 1px 10px rgba(0,0,0,0.748);
position: relative;
}

.toggle-btn .thumb
{
height: 20px;
width: 20px;
background: #fff;
border-radius: 99px;
transform: translateX(0);
transition: left 0.15s ease;
position: absolute;
left: 3px;
top: 50%;
transform: translateY(-50%);

}

.toggle-btn.toggled
{
background-color: #15b58e;
}

.toggled-btn:hover
{
border-color: #6f6f6f;
}
.toggle-btn.toggled .thumb
{
left: calc(50px - 25px);
}