From 6f6fcd57d362c5b3c5e7b2e5d7e68ec710469f39 Mon Sep 17 00:00:00 2001 From: ray Date: Sat, 25 Apr 2020 21:54:48 +0100 Subject: [PATCH] add very basic skeleton --- src/App.js | 65 +++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 15 deletions(-) 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 - -
+
); }