Commit 065dc0ab authored by Alexander Kotov's avatar Alexander Kotov

render tower disks from props

parent 898e6c17
......@@ -4,12 +4,31 @@ import './App.css'
import Tower from './components/Tower/Tower.jsx'
class App extends Component {
constructor() {
super()
this.state = {
towers: {
left: [
{ color: '#669BBC', width: 20 },
{ color: '#A8C686', width: 40 },
{ color: '#F3A712', width: 60 },
{ color: '#29335C', width: 80 },
{ color: '#E4572E', width: 100 }
],
center: [],
right: []
}
}
}
render() {
const {left, center, right} = this.state.towers
return (
<div className="Board">
<Tower></Tower>
<Tower></Tower>
<Tower></Tower>
<Tower disks={left}></Tower>
<Tower disks={center}></Tower>
<Tower disks={right}></Tower>
</div>
);
}
......
......@@ -12,13 +12,7 @@ const diskStyle = d => {
export default class Tower extends Component {
render() {
const disks = [
{ color: '#669BBC', width: 20 },
{ color: '#A8C686', width: 40 },
{ color: '#F3A712', width: 60 },
{ color: '#29335C', width: 80 },
{ color: '#E4572E', width: 100 }
]
const disks = this.props.disks
return (
<div className="Tower">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment