-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathTimelineControls.tsx
50 lines (43 loc) · 1.16 KB
/
TimelineControls.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import * as React from 'react';
import styled from 'styled-components';
import { useStore } from '../store';
import Button from './Button';
import Coords from './Coords';
import Time from './Time';
import TimelineBar from './TimelineBar';
import PauseIcon from './icons/PauseIcon';
import PlayIcon from './icons/PlayIcon';
import ResetIcon from './icons/ResetIcon';
const Wrapper = styled.div`
max-height: 50px;
width: 100%;
display: grid;
grid-template-columns: 150px auto 150px 80px 80px;
align-items: center;
padding-top: 8px;
`;
interface Props {}
const TimelineControls: React.FC<Props> = () => {
const { grapher } = useStore();
const [paused, setPaused] = React.useState(false);
return (
<Wrapper>
<Coords />
<TimelineBar />
<Time />
<Button name={'reset-time'} onClick={() => grapher.resetTime()}>
<ResetIcon />
</Button>
<Button
name={paused ? 'start-time' : 'pause-time'}
onClick={() => {
setPaused(!paused);
grapher.togglePlay();
}}
>
{paused ? <PlayIcon /> : <PauseIcon />}
</Button>
</Wrapper>
);
};
export default TimelineControls;