-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
3037d18
commit 7db43e0
Showing
7 changed files
with
76 additions
and
8 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
57 changes: 55 additions & 2 deletions
57
audience-display/src/displays/fgc_2018/sponsor/SponsorScreen.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 |
---|---|---|
@@ -1,16 +1,69 @@ | ||
import * as React from "react"; | ||
import "./SponsorScreen.css"; | ||
|
||
class SponsorScreen extends React.Component { | ||
import REV_LOGO from "../res/sponsors/REV.jpg"; | ||
|
||
const IMAGE_TIME = 5000; | ||
|
||
interface IState { | ||
activeIndex: number | ||
} | ||
|
||
class SponsorScreen extends React.Component<{}, IState> { | ||
private _timerID: any; | ||
private _sponsors: string[]; | ||
|
||
constructor(props: any) { | ||
super(props); | ||
this._timerID = null; | ||
this._sponsors = [REV_LOGO]; | ||
|
||
this.state = { | ||
activeIndex: -1 | ||
}; | ||
} | ||
|
||
public componentDidMount() { | ||
this.startImageCarousel(this._sponsors); | ||
} | ||
|
||
public componentWillUnmount() { | ||
this.stopImageCarousel(); | ||
} | ||
|
||
public render() { | ||
const {activeIndex} = this.state; | ||
return ( | ||
<div id="fgc-body"> | ||
<div id="fgc-sponsor-container"> | ||
<span>Thank you to our wonderful sponsors...</span> | ||
<div id="fgc-sponsor-header"> | ||
<span>Thank you to our wonderful sponsors</span> | ||
</div> | ||
<div id="fgc-sponsor-image"> | ||
<img src={this._sponsors[activeIndex]} className="fit-h"/> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
private startImageCarousel(imagesUrls: string[]) { | ||
this.setState({activeIndex: 0}); | ||
this._timerID = global.setInterval(() => { | ||
let newIndex = this.state.activeIndex + 1; | ||
if (newIndex > imagesUrls.length - 1) { | ||
newIndex = 0; | ||
} | ||
console.log("Switching to new index: " + newIndex); | ||
this.setState({activeIndex: newIndex}); | ||
}, IMAGE_TIME); | ||
} | ||
|
||
private stopImageCarousel() { | ||
if (this._timerID !== null) { | ||
global.clearInterval(this._timerID); | ||
} | ||
} | ||
} | ||
|
||
export default SponsorScreen; |
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