forked from noahpresler/semesterly
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1123 from zydtiger/refractor/ui
Refractor/UI
- Loading branch information
Showing
8 changed files
with
92 additions
and
82 deletions.
There are no files selected for viewing
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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,47 @@ | ||
/* | ||
Copyright (C) 2017 Semester.ly Technologies, LLC | ||
Semester.ly is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Semester.ly is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
*/ | ||
|
||
import React, { useState } from "react"; | ||
|
||
interface SideScrollerProps { | ||
content: JSX.Element[]; | ||
navItems: JSX.Element[]; | ||
} | ||
|
||
function SideScroller(props: SideScrollerProps) { | ||
const [activeSlide, setActiveSlide] = useState(0); | ||
|
||
let navItems = null; | ||
if (props.navItems) { | ||
const navs = []; | ||
|
||
for (let i = 0; i < props.navItems.length; i++) { | ||
const cls = activeSlide === i ? " nav-item-active" : ""; | ||
navs.push( | ||
<span key={i} className={`nav-item${cls}`} onClick={() => setActiveSlide(i)}> | ||
{props.navItems[i]} | ||
</span> | ||
); | ||
} | ||
navItems = <div className="scroll-nav">{navs}</div>; | ||
} | ||
return ( | ||
<div> | ||
{navItems} | ||
{props.content[activeSlide]} | ||
</div> | ||
); | ||
} | ||
|
||
export default SideScroller; |
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 was deleted.
Oops, something went wrong.