diff --git a/src/App.js b/src/App.js index ce9cbd2..9b70163 100644 --- a/src/App.js +++ b/src/App.js @@ -1,24 +1,59 @@ import React from 'react'; -import logo from './logo.svg'; +import styled from 'styled-components'; import './App.css'; +const DEFAULT_SHADE_COUNT = 9; + +// an object to hold our styled components +const S = {}; + +class Shade extends React.Component { + render() { + return ( +
{this.props.color}
+ ); + } +} + +S.Shade = styled(Shade)` + padding: 1rem 2rem; + background-color: ${props => props.color}; +`; + +class Color extends React.Component { + constructor(props) { + super(props); + this.state = { + baseColor: this.props.baseColor, + shades: [], + shadeCount: this.props.shadeCount ? this.props.shadeCount : DEFAULT_SHADE_COUNT, + } + for (let index = 0; index < this.state.shadeCount; index++) { + this.state.shades.push(this.props.baseColor); + } + } + + render() { + return ( + + ); + } +} + +S.Color = styled(Color)` +list-style: none; +padding: 0; +margin: 0; +`; + function App() { return (
-
- logo -

- Edit src/App.js and save to reload. -

- - Learn React - -
+
); }