File tree Expand file tree Collapse file tree 7 files changed +76
-24
lines changed Expand file tree Collapse file tree 7 files changed +76
-24
lines changed Original file line number Diff line number Diff line change 11import React from 'react' ;
2- import styled from 'styled-components' ;
2+ import styled , { createGlobalStyle } from 'styled-components' ;
33import UseTimerDemo from './components/UseTimerDemo' ;
44import UseStopwatchDemo from './components/UseStopwatchDemo' ;
55import UseTimeDemo from './components/UseTimeDemo' ;
66
7- const StylesApp = styled . div `
7+ const GlobalStyle = createGlobalStyle `
8+ html, body {
9+ padding: 0;
10+ margin: 0;
11+ background-color: #232323;
12+ font-family: Arial;
13+ color: white;
14+ }
15+ ` ;
16+
17+ const StyledApp = styled . div `
818 flex: 1;
919 width: 100%;
1020 height: 100%;
11- background-color: #232323;
21+ ` ;
22+
23+ const StyledHeader = styled . h1 `
24+ text-align: center;
25+ color: white;
26+ ` ;
27+
28+ const StyledSeparator = styled . div `
29+ height: 3px;
30+ background-color: white;
31+ margin-top: 30px;
1232` ;
1333
1434export default function App ( ) {
1535 const time = new Date ( ) ;
16- // time.setSeconds(time.getSeconds() + 600); // 10 minutes timer
17- time . setMilliseconds ( time . getMilliseconds ( ) + 100 ) ; // 6.5 seconds timer
36+ time . setSeconds ( time . getSeconds ( ) + 600 ) ; // 10 minutes timer
37+ // time.setMilliseconds(time.getMilliseconds() + 100); // 6.5 seconds timer
1838 return (
19- < StylesApp >
39+ < StyledApp >
40+ < GlobalStyle />
41+ < StyledHeader > react-timer-hook</ StyledHeader >
2042 < UseTimerDemo expiryTimestamp = { time } />
43+ < StyledSeparator />
2144 < UseStopwatchDemo />
45+ < StyledSeparator />
2246 < UseTimeDemo />
23- </ StylesApp >
47+ < StyledSeparator />
48+ </ StyledApp >
2449 ) ;
2550}
Original file line number Diff line number Diff line change @@ -2,13 +2,14 @@ import React from 'react';
22import styled from 'styled-components' ;
33
44const StyledButton = styled . button `
5- background-color: #73D1FE ;
5+ background-color: white ;
66 border-radius: 5;
77 margin: 0 5px 0 5px;
88 outline: none;
99 border: none;
1010 padding: 5px 10px;
11- color: white;
11+ color: #404549;
12+ border-radius: 3px;
1213` ;
1314
1415export default function Button ( props ) {
Original file line number Diff line number Diff line change @@ -19,14 +19,27 @@ const StyledDigitContainer = styled.div`
1919` ;
2020
2121const StyledSingleDigit = styled . span `
22+ position: relative;
2223 display: flex;
2324 flex: 0 1 25%;
24- font-size: 70px ;
25+ font-size: 50px ;
2526 background-color: #404549;
2627 border-radius: 5px;
2728 padding: 5px 20px;
2829 color: white;
2930 margin: 0 5px;
31+ &:after {
32+ position: absolute;
33+ left: 0px;
34+ right: 0px;
35+ top: 50%;
36+ bottom: 50%;
37+ content: "";
38+ width: '100%';
39+ height: 2px;
40+ background-color: #232323;
41+ opacity: 0.5;
42+ }
3043` ;
3144
3245export default function Digit ( { value, title, addSeparator } : Object ) {
Original file line number Diff line number Diff line change @@ -14,15 +14,15 @@ const StyledSepartorContainer = styled.span`
1414 flex-direction: column;
1515 align-items: center;
1616 align-self: flex-end;
17- margin-bottom: 20px ;
17+ margin: 0 5px 10px 5px ;
1818` ;
1919
2020const StyledSepartor = styled . span `
2121 display: inline-block;
22- width: 16px ;
23- height: 16px ;
22+ width: 12px ;
23+ height: 12px ;
2424 background-color: white;
25- border-radius: 8px ;
25+ border-radius: 6px ;
2626 margin: 5px 0;
2727` ;
2828
Original file line number Diff line number Diff line change 11import React from 'react' ;
22import { useStopwatch } from '../../src/index' ;
33import Button from './Button' ;
4- import Digit from './Digit' ;
54import StyledTimer from './StyledTimer' ;
65
76export default function UseStopwatchDemo ( ) {
@@ -19,7 +18,7 @@ export default function UseStopwatchDemo() {
1918
2019 return (
2120 < div style = { { textAlign : 'center' } } >
22- < p > Stopwatch Demo</ p >
21+ < h2 > UseStopwatch Demo</ h2 >
2322 < StyledTimer seconds = { seconds } minutes = { minutes } hours = { hours } days = { days } />
2423 < p > { isRunning ? 'Running' : 'Not running' } </ p >
2524 < Button onClick = { start } > Start</ Button >
Original file line number Diff line number Diff line change 11import React from 'react' ;
2+ import styled from 'styled-components' ;
23import { useTime } from '../../src/index' ;
34import StyledTimer from './StyledTimer' ;
45
6+ const StyledRow = styled . div `
7+ flex: 1;
8+ display: flex;
9+ justify-content: center;
10+ align-items: center;
11+ ` ;
12+
13+ const StyledText = styled . span `
14+ font-size: 60px;
15+ color: white;
16+ margin-left: 20px;
17+ margin-top: 12px;
18+ ` ;
19+
520export default function UseTimeDemo ( ) {
621 const {
722 seconds,
823 minutes,
924 hours,
1025 ampm,
11- } = useTime ( { format : '12-hour' } ) ;
26+ } = useTime ( { } ) ;
1227
1328 return (
1429 < div style = { { textAlign : 'center' } } >
15- < p > Current Time Demo</ p >
16- < div style = { { fontSize : '100px' } } >
17- < StyledTimer seconds = { seconds } minutes = { minutes } hours = { hours } />
18- < span > { ampm } </ span >
19- </ div >
30+ < h2 > UseTime Demo</ h2 >
31+ < StyledRow >
32+ < StyledTimer seconds = { seconds } minutes = { minutes } hours = { hours } />
33+ < StyledText > { ampm } </ StyledText >
34+ </ StyledRow >
2035 </ div >
2136 ) ;
2237}
Original file line number Diff line number Diff line change @@ -19,8 +19,7 @@ export default function UseTimerDemo({ expiryTimestamp }) {
1919
2020 return (
2121 < div style = { { textAlign : 'center' } } >
22- < h1 > react-timer-hook </ h1 >
23- < p > Timer Demo</ p >
22+ < h2 > UseTimer Demo</ h2 >
2423 < StyledTimer seconds = { seconds } minutes = { minutes } hours = { hours } days = { days } />
2524 < p > { isRunning ? 'Running' : 'Not running' } </ p >
2625 < Button type = "button" onClick = { start } > Start</ Button >
You can’t perform that action at this time.
0 commit comments