From 429e65f7c699664e3355af651b013b4e32d2960d Mon Sep 17 00:00:00 2001 From: Mathias Date: Tue, 2 Mar 2021 20:58:12 +0100 Subject: [PATCH] Cleanup lab2 --- lab2/src/components/App/App.css | 36 ++++++------- .../BackgroundColorPicker.js | 50 ++++++------------- .../BackgroundColorPicker/colors.js | 20 ++++++++ lab2/src/components/List/List.js | 4 +- lab2/src/index.css | 7 +-- 5 files changed, 57 insertions(+), 60 deletions(-) create mode 100644 lab2/src/components/BackgroundColorPicker/colors.js diff --git a/lab2/src/components/App/App.css b/lab2/src/components/App/App.css index 61e3b2e..8a4bc3d 100644 --- a/lab2/src/components/App/App.css +++ b/lab2/src/components/App/App.css @@ -1,31 +1,27 @@ -#root { - background: whitesmoke; -} - .App { - padding: 25px 15px 25px 15px; - border: 2px solid gray; - min-height: 250px; + padding: 25px 15px 25px 15px; + border: 2px solid gray; + min-height: 250px; } .App-header { - background-color: #222; - height: 150px; - padding: 20px; - color: white; - font-size: 42px; - text-align: center; + background-color: #222; + height: 150px; + padding: 20px; + color: white; + font-size: 42px; + text-align: center; } .App-header-description { - font-size: 18px; + font-size: 18px; } @keyframes App-logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } } diff --git a/lab2/src/components/BackgroundColorPicker/BackgroundColorPicker.js b/lab2/src/components/BackgroundColorPicker/BackgroundColorPicker.js index 958d31b..31606c4 100644 --- a/lab2/src/components/BackgroundColorPicker/BackgroundColorPicker.js +++ b/lab2/src/components/BackgroundColorPicker/BackgroundColorPicker.js @@ -1,40 +1,20 @@ import React, { Component } from "react"; +import colors from "./colors"; import "./BackgroundColorPicker.css"; -const BackgroundColorPicker = ({ onChange }) => { - const colors = [ - { - hex: "lavender", - name: "lavender", - }, - { - hex: "gold", - name: "gold", - }, - { - hex: "#f48c42", - name: "🎃", - }, - { - hex: "rebeccapurple", - name: "Beautiful purple", - }, - ]; - - return ( -
-
Välj bakgrundsfärg
- -
- ); -}; +const BackgroundColorPicker = ({ onChange }) => ( +
+
Välj bakgrundsfärg
+ +
+); export default BackgroundColorPicker; diff --git a/lab2/src/components/BackgroundColorPicker/colors.js b/lab2/src/components/BackgroundColorPicker/colors.js new file mode 100644 index 0000000..a0845d9 --- /dev/null +++ b/lab2/src/components/BackgroundColorPicker/colors.js @@ -0,0 +1,20 @@ +const colors = [ + { + hex: "lavender", + name: "lavender", + }, + { + hex: "gold", + name: "gold", + }, + { + hex: "#f48c42", + name: "🎃", + }, + { + hex: "rebeccapurple", + name: "Beautiful purple", + }, +]; + +export default colors; diff --git a/lab2/src/components/List/List.js b/lab2/src/components/List/List.js index 21080be..d813e00 100644 --- a/lab2/src/components/List/List.js +++ b/lab2/src/components/List/List.js @@ -24,12 +24,12 @@ const List = ({ items = [], title }) => {

{title}

{items.length === 0 ? ( -
Empty list...
+
Empty list...
) : ( diff --git a/lab2/src/index.css b/lab2/src/index.css index 22f8f18..3b8acbd 100644 --- a/lab2/src/index.css +++ b/lab2/src/index.css @@ -1,5 +1,6 @@ body { - margin: 0; - padding: 0; - font-family: sans-serif; + margin: 0; + padding: 0; + font-family: sans-serif; + background: whitesmoke; }