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 1
1
import React from 'react' ;
2
- import styled from 'styled-components' ;
2
+ import styled , { createGlobalStyle } from 'styled-components' ;
3
3
import UseTimerDemo from './components/UseTimerDemo' ;
4
4
import UseStopwatchDemo from './components/UseStopwatchDemo' ;
5
5
import UseTimeDemo from './components/UseTimeDemo' ;
6
6
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 `
8
18
flex: 1;
9
19
width: 100%;
10
20
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;
12
32
` ;
13
33
14
34
export default function App ( ) {
15
35
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
18
38
return (
19
- < StylesApp >
39
+ < StyledApp >
40
+ < GlobalStyle />
41
+ < StyledHeader > react-timer-hook</ StyledHeader >
20
42
< UseTimerDemo expiryTimestamp = { time } />
43
+ < StyledSeparator />
21
44
< UseStopwatchDemo />
45
+ < StyledSeparator />
22
46
< UseTimeDemo />
23
- </ StylesApp >
47
+ < StyledSeparator />
48
+ </ StyledApp >
24
49
) ;
25
50
}
Original file line number Diff line number Diff line change @@ -2,13 +2,14 @@ import React from 'react';
2
2
import styled from 'styled-components' ;
3
3
4
4
const StyledButton = styled . button `
5
- background-color: #73D1FE ;
5
+ background-color: white ;
6
6
border-radius: 5;
7
7
margin: 0 5px 0 5px;
8
8
outline: none;
9
9
border: none;
10
10
padding: 5px 10px;
11
- color: white;
11
+ color: #404549;
12
+ border-radius: 3px;
12
13
` ;
13
14
14
15
export default function Button ( props ) {
Original file line number Diff line number Diff line change @@ -19,14 +19,27 @@ const StyledDigitContainer = styled.div`
19
19
` ;
20
20
21
21
const StyledSingleDigit = styled . span `
22
+ position: relative;
22
23
display: flex;
23
24
flex: 0 1 25%;
24
- font-size: 70px ;
25
+ font-size: 50px ;
25
26
background-color: #404549;
26
27
border-radius: 5px;
27
28
padding: 5px 20px;
28
29
color: white;
29
30
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
+ }
30
43
` ;
31
44
32
45
export 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`
14
14
flex-direction: column;
15
15
align-items: center;
16
16
align-self: flex-end;
17
- margin-bottom: 20px ;
17
+ margin: 0 5px 10px 5px ;
18
18
` ;
19
19
20
20
const StyledSepartor = styled . span `
21
21
display: inline-block;
22
- width: 16px ;
23
- height: 16px ;
22
+ width: 12px ;
23
+ height: 12px ;
24
24
background-color: white;
25
- border-radius: 8px ;
25
+ border-radius: 6px ;
26
26
margin: 5px 0;
27
27
` ;
28
28
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import { useStopwatch } from '../../src/index' ;
3
3
import Button from './Button' ;
4
- import Digit from './Digit' ;
5
4
import StyledTimer from './StyledTimer' ;
6
5
7
6
export default function UseStopwatchDemo ( ) {
@@ -19,7 +18,7 @@ export default function UseStopwatchDemo() {
19
18
20
19
return (
21
20
< div style = { { textAlign : 'center' } } >
22
- < p > Stopwatch Demo</ p >
21
+ < h2 > UseStopwatch Demo</ h2 >
23
22
< StyledTimer seconds = { seconds } minutes = { minutes } hours = { hours } days = { days } />
24
23
< p > { isRunning ? 'Running' : 'Not running' } </ p >
25
24
< Button onClick = { start } > Start</ Button >
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
+ import styled from 'styled-components' ;
2
3
import { useTime } from '../../src/index' ;
3
4
import StyledTimer from './StyledTimer' ;
4
5
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
+
5
20
export default function UseTimeDemo ( ) {
6
21
const {
7
22
seconds,
8
23
minutes,
9
24
hours,
10
25
ampm,
11
- } = useTime ( { format : '12-hour' } ) ;
26
+ } = useTime ( { } ) ;
12
27
13
28
return (
14
29
< 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 >
20
35
</ div >
21
36
) ;
22
37
}
Original file line number Diff line number Diff line change @@ -19,8 +19,7 @@ export default function UseTimerDemo({ expiryTimestamp }) {
19
19
20
20
return (
21
21
< div style = { { textAlign : 'center' } } >
22
- < h1 > react-timer-hook </ h1 >
23
- < p > Timer Demo</ p >
22
+ < h2 > UseTimer Demo</ h2 >
24
23
< StyledTimer seconds = { seconds } minutes = { minutes } hours = { hours } days = { days } />
25
24
< p > { isRunning ? 'Running' : 'Not running' } </ p >
26
25
< Button type = "button" onClick = { start } > Start</ Button >
You can’t perform that action at this time.
0 commit comments