parent
cf4ff04e40
commit
0b962aaad6
17 changed files with 198 additions and 65 deletions
@ -0,0 +1,10 @@ |
||||
var React = require('react'); |
||||
var Grid = require('./Grid'); |
||||
var Welcome = require('./Welcome'); |
||||
|
||||
module.exports = React.createClass({ |
||||
render() { |
||||
//return (<div><Grid width='6' height='5' /></div>);
|
||||
return (<Welcome />); |
||||
} |
||||
}); |
@ -0,0 +1,30 @@ |
||||
var React = require('react'); |
||||
|
||||
var Entry = React.createClass({ |
||||
render() { |
||||
return ( |
||||
<div className='entry'> |
||||
<div className='rank'>{this.props.rank}</div> |
||||
<div className='initials'>{this.props.initials}</div> |
||||
<div className='score'>{this.props.score}</div> |
||||
</div> |
||||
); |
||||
} |
||||
}); |
||||
|
||||
|
||||
module.exports = React.createClass({ |
||||
render() { |
||||
var entries = []; |
||||
entries.push(<Entry initials="ABA" score="219283" rank="1" key="0" />); |
||||
entries.push(<Entry initials="ABA" score="107112" rank="2" key="1" />); |
||||
entries.push(<Entry initials="ABA" score="81091" rank="3" key="2" />); |
||||
entries.push(<Entry initials="ABA" score="67747" rank="4" key="3" />); |
||||
entries.push(<Entry initials="ABA" score="9283" rank="5" key="4" />); |
||||
entries.push(<Entry initials="ABA" score="928" rank="6" key="5" />); |
||||
|
||||
return ( |
||||
<div className='highscores'>{entries}</div> |
||||
); |
||||
} |
||||
}); |
@ -0,0 +1,49 @@ |
||||
require('../sass/welcome.scss'); |
||||
|
||||
var React = require('react'); |
||||
var HighScores = require('./HighScores'); |
||||
|
||||
var toggleTimeout = function() { |
||||
var hidden = this.state.hidden; |
||||
|
||||
setTimeout(function() { |
||||
this.setState({ hidden: !hidden }); |
||||
toggleTimeout.call(this); |
||||
}.bind(this), 1000); |
||||
}; |
||||
|
||||
var NewGame = React.createClass({ |
||||
getInitialState() { |
||||
return { |
||||
hidden: false |
||||
} |
||||
}, |
||||
|
||||
componentDidMount() { |
||||
toggleTimeout.call(this); |
||||
}, |
||||
|
||||
render() { |
||||
var classname = ['newgame']; |
||||
|
||||
if (this.state.hidden === true) { |
||||
classname.push('hidden'); |
||||
} |
||||
|
||||
return ( |
||||
<div className={classname.join(' ')}>Press Space Bar To Play</div> |
||||
); |
||||
} |
||||
}); |
||||
|
||||
module.exports = React.createClass({ |
||||
render() { |
||||
return ( |
||||
<div className='welcome'> |
||||
<img src="res/title.png" /> |
||||
<NewGame /> |
||||
<HighScores /> |
||||
</div> |
||||
); |
||||
} |
||||
}); |
@ -1,5 +1,7 @@ |
||||
require('../sass/reset.scss'); |
||||
|
||||
var React = require('react'); |
||||
var ReactDOM = require('react-dom'); |
||||
var Grid = require('./Grid.js'); |
||||
var ReactDom = require('react-dom'); |
||||
var App = require('./App'); |
||||
|
||||
ReactDOM.render(<Grid width="6" height="5" />, document.getElementById('grid')); |
||||
ReactDom.render(<App />, document.getElementById('app')); |
||||
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 631 B |
After Width: | Height: | Size: 31 KiB |
@ -0,0 +1,29 @@ |
||||
.x-1 { left: -100px; } |
||||
.x0 { left: 0; } |
||||
.x1 { left: 100px; } |
||||
.x2 { left: 200px; } |
||||
.x3 { left: 300px; } |
||||
.x4 { left: 400px; } |
||||
.x5 { left: 500px; } |
||||
.x6 { left: 600px; } |
||||
|
||||
.y-1 { top: -100px; } |
||||
.y0 { top: 0; } |
||||
.y1 { top:100px; } |
||||
.y2 { top: 200px; } |
||||
.y3 { top: 300px; } |
||||
.y4 { top: 400px; } |
||||
.y5 { top: 500px; } |
||||
.y6 { top: 600px; } |
||||
|
||||
//$cellW: 100px; |
||||
//$cellH: 100px; |
||||
|
||||
.cell { |
||||
border:1px solid purple; |
||||
height:100px; |
||||
line-height:100px; |
||||
position:absolute; |
||||
text-align:center; |
||||
width:100px; |
||||
} |
@ -0,0 +1,6 @@ |
||||
#grid { |
||||
height:500px; |
||||
overflow:hidden; |
||||
position:relative; |
||||
width:600px; |
||||
} |
@ -0,0 +1,6 @@ |
||||
* { |
||||
box-sizing:border-box; |
||||
font-family:Emulogic; |
||||
margin: 0; |
||||
padding: 0; |
||||
} |
@ -0,0 +1,45 @@ |
||||
.welcome { |
||||
padding:20px; |
||||
text-align:center; |
||||
|
||||
img { |
||||
width:350px; |
||||
} |
||||
|
||||
.highscores { |
||||
font-size: 0; |
||||
margin:0 auto; |
||||
width:350px; |
||||
|
||||
.entry { |
||||
font-size:16px; |
||||
line-height:40px; |
||||
} |
||||
|
||||
.rank { |
||||
display:inline-block; |
||||
text-align:left; |
||||
width:50px; |
||||
} |
||||
|
||||
.initials { |
||||
display:inline-block; |
||||
width:100px; |
||||
} |
||||
|
||||
.score { |
||||
display:inline-block; |
||||
text-align:right; |
||||
width:200px; |
||||
} |
||||
} |
||||
|
||||
.newgame { |
||||
margin:20px 0; |
||||
transition:opacity 0.4s ease; |
||||
|
||||
&.hidden { |
||||
opacity: 0.7; |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue