diff --git a/my-app/src/App.tsx b/my-app/src/App.tsx index 1eee8f9..0de0e9b 100644 --- a/my-app/src/App.tsx +++ b/my-app/src/App.tsx @@ -1,9 +1,16 @@ import './App.css'; -import Counters from './Components/Counters'; +import Counters from './Components/Counters/Counters'; +import styled from 'styled-components'; + +const MainWrapper = styled.div` +`; + function App() { return ( - + + + ); } diff --git a/my-app/src/Components/Counters.tsx b/my-app/src/Components/Counters.tsx deleted file mode 100644 index fd35013..0000000 --- a/my-app/src/Components/Counters.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import * as S from "./Componets.style"; - - -const Counters = () => { - return ( - - - - hej1 - - - hej2 - - - hej3 - - - hej4 - - - - ); -} - -export default Counters; diff --git a/my-app/src/Components/Componets.style.ts b/my-app/src/Components/Counters/Counters.style.ts similarity index 59% rename from my-app/src/Components/Componets.style.ts rename to my-app/src/Components/Counters/Counters.style.ts index f461a8a..5cfa738 100644 --- a/my-app/src/Components/Componets.style.ts +++ b/my-app/src/Components/Counters/Counters.style.ts @@ -3,7 +3,7 @@ import styled from "styled-components"; export const CountersWrapper = styled.div` width: 100vw; height: 100vh; - background-color: black; + background-color: #4f4f4f; `; export const CountersGrid = styled.div` @@ -11,16 +11,16 @@ export const CountersGrid = styled.div` flex-wrap: wrap; justify-content: center; align-items: center; - background-color: red; border-radius: 10px; + -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */ + -moz-box-sizing: border-box; /* Firefox, other Gecko */ + box-sizing: border-box; /* Opera/IE 8+ */ `; -export const GridItem = styled.div` +export const GridItemContainer = styled.div` display: flex; width: 50%; height: 50vh; justify-content: center; align-items: center; - background-color: antiquewhite; - border-radius: 10px; `; diff --git a/my-app/src/Components/Counters/Counters.tsx b/my-app/src/Components/Counters/Counters.tsx new file mode 100644 index 0000000..bffffda --- /dev/null +++ b/my-app/src/Components/Counters/Counters.tsx @@ -0,0 +1,26 @@ +import * as S from "./Counters.style"; +import LifeCounter from "../LifeCounter/LifeCounter"; + + +const Counters = () => { + return ( + + + + + + + + + + + + + + + + + ); +} + +export default Counters; diff --git a/my-app/src/Components/LifeCounter/LifeCounter.style.ts b/my-app/src/Components/LifeCounter/LifeCounter.style.ts new file mode 100644 index 0000000..8177a5f --- /dev/null +++ b/my-app/src/Components/LifeCounter/LifeCounter.style.ts @@ -0,0 +1,37 @@ +import styled from "styled-components"; + + +//LifeCounterWrapper with a background color variable: +export const LifeCounterWrapper = styled.div<{ backgroundColor?: string }>` + display: flex; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; + background-color: ${props => props.backgroundColor || "antiquewhite"}; + border-radius: 10px; + +`; + +export const LifeCounterButton = styled.button` + width: 100%; + height: 100%; + font-size: 5rem; + font-weight: bold; + background-color: transparent; + border: none; + outline: none; + cursor: pointer; +`; + +export const LifeCounterText = styled.p` + font-size: 5rem; + font-weight: bold; + text-align: center; + margin: 0; + padding: 0; + +`; + + + diff --git a/my-app/src/Components/LifeCounter/LifeCounter.tsx b/my-app/src/Components/LifeCounter/LifeCounter.tsx new file mode 100644 index 0000000..b2e55e8 --- /dev/null +++ b/my-app/src/Components/LifeCounter/LifeCounter.tsx @@ -0,0 +1,20 @@ +import { useState } from "react"; +import * as S from "./LifeCounter.style"; + +type LifeCounterProps = { + backgroundColor: string; +} + +const LifeCounter = ({backgroundColor}: LifeCounterProps) => { + const [life, setLife] = useState(40); + + return ( + + setLife(life - 1)}>- + {life} + setLife(life + 1)}>+ + + ); +} + +export default LifeCounter; \ No newline at end of file