Commit 898e6c17 authored by Alexander Kotov's avatar Alexander Kotov

same disks with map

parent 1c3842c8
......@@ -2,16 +2,29 @@ import React, { Component } from 'react'
import './Tower.css'
const diskStyle = d => {
return {
backgroundColor: d.color,
width: d.width + '%'
}
}
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 }
]
return (
<div className="Tower">
<div className="Disk" style={{backgroundColor: '#669BBC', width: '20%'}}></div>
<div className="Disk" style={{backgroundColor: '#A8C686', width: '40%'}}></div>
<div className="Disk" style={{backgroundColor: '#F3A712', width: '60%'}}></div>
<div className="Disk" style={{backgroundColor: '#29335C', width: '80%'}}></div>
<div className="Disk" style={{backgroundColor: '#E4572E', width: '100%'}}></div>
{disks.map(d => {
return <div className="Disk" style={diskStyle(d)}></div>
})}
</div>
)
}
......
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