diff --git a/solutions/day-4/src/App.css b/solutions/day-4/src/App.css index b924e94..dcecd70 100644 --- a/solutions/day-4/src/App.css +++ b/solutions/day-4/src/App.css @@ -152,11 +152,20 @@ h2 { padding: 4px 8px; color: #fff; } -.colorGen{ +.colorGen { display: flex; flex-direction: column; align-items: center; - color: #f37575; + width: 100%; +} + +.color { + display: flex; + justify-content: center; + align-items: center; + height: 50px; + width: 80%; + color: #fff; } .colorGen button{ background-color: #f37575; diff --git a/solutions/day-4/src/components/colorGenComp.js b/solutions/day-4/src/components/colorGenComp.js index 988c886..3ecd880 100644 --- a/solutions/day-4/src/components/colorGenComp.js +++ b/solutions/day-4/src/components/colorGenComp.js @@ -1,28 +1,26 @@ import React from "react"; - export default function ColorGen() { - let str = '0123456789abcdef'; - let hexColor = () => { + + let hexcolor = () => { let color = ''; + let str = '0123456789abcdef'; for (let i = 0; i < 6; i++) { - let hex = Math.floor(Math.random() * str.length); - color += str[hex]; + let hex = Math.floor(Math.random() * str.length ); + color += str[hex]; } return '#' + color; } - let style = { - backgroundColor: '{hexColor}', - } + let arr = Array(6).fill(0); + + let sixColor = arr.map((i) =>
+

{ hexcolor()}

+
); + // console.log(hexcolor()); + return (
-
- {hexColor()} -
- + {sixColor}
) -} - -// I DO NOT KNOW WHAT I AM DONING WRONG IN MY CODE. BUT ICAN'T SEE THE CHANGE OF BACKGROUND COLOR AFTER GIVING THE HEIGHT AND WIDTH TO THE COLOR CONTAINER \ No newline at end of file +} \ No newline at end of file