-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathMainControls.js
51 lines (42 loc) · 1.48 KB
/
MainControls.js
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
51
import React from 'react';
import styled from 'styled-components';
import API from 'api';
import UIState from 'ui/states/UIState';
import { connectToState } from 'ui/states/connector';
import ActionIcon from 'ui/components/common/ActionIcon';
import MasterToggle from 'ui/components/BottomBar/MasterToggle';
import FrameHeightToggle from 'ui/components/BottomBar/FrameHeightToggle';
import { Div } from 'ui/components/common/base';
const MainActions = styled(Div)`
display: flex;
flex: 1;
justify-content: flex-end;
align-items: center;
`;
const Action = styled(Div)`
cursor: pointer;
display: flex;
align-items: center;
height: 25px;
padding: 0 6px;
user-select: none;
background-color: ${(props) => props.isActive ? props.theme.blue : 'inherit'};
${(props) => props.isInactive ? 'background-color: #e5e5e5;' : ''}
`;
export const MainControls = ({ closeFullEditor }) => (
<MainActions>
<Action onClick={ () => window.open('https://mimic.js.org') }>
<ActionIcon action="help"/>
</Action>
<Action onClick={ () => UIState.setViewMode('settings') }
isActive={ UIState.viewMode === 'settings' }>
<ActionIcon action="settings" active={ UIState.viewMode === 'settings' }/>
</Action>
<MasterToggle/>
{ API.mode !== 'remote' && <FrameHeightToggle/> }
<Action>
<ActionIcon action="close" onClick={ () => UIState.setViewMode('closed') }/>
</Action>
</MainActions>
);
export default connectToState(UIState, MainControls);