diff options
author | Dominik Guzei <dominik.guzei@gmail.com> | 2019-03-21 15:04:31 +0100 |
---|---|---|
committer | Dominik Guzei <dominik.guzei@gmail.com> | 2019-03-21 15:04:31 +0100 |
commit | a9734f24bf15ab322c8244fbb8e86c37caf30f4a (patch) | |
tree | ace7e455e817df831bf571aa4851a99b0e37e145 /src/features/workspaces/components/WorkspaceSwitchingIndicator.js | |
parent | add workspace drawer toggle menu item and shortcut (diff) | |
download | ferdium-app-a9734f24bf15ab322c8244fbb8e86c37caf30f4a.tar.gz ferdium-app-a9734f24bf15ab322c8244fbb8e86c37caf30f4a.tar.zst ferdium-app-a9734f24bf15ab322c8244fbb8e86c37caf30f4a.zip |
improve workspace switching ux
Diffstat (limited to 'src/features/workspaces/components/WorkspaceSwitchingIndicator.js')
-rw-r--r-- | src/features/workspaces/components/WorkspaceSwitchingIndicator.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/features/workspaces/components/WorkspaceSwitchingIndicator.js b/src/features/workspaces/components/WorkspaceSwitchingIndicator.js new file mode 100644 index 000000000..4a279afaf --- /dev/null +++ b/src/features/workspaces/components/WorkspaceSwitchingIndicator.js | |||
@@ -0,0 +1,56 @@ | |||
1 | import React, { Component } from 'react'; | ||
2 | import PropTypes from 'prop-types'; | ||
3 | import { observer } from 'mobx-react'; | ||
4 | import injectSheet from 'react-jss'; | ||
5 | import { workspacesState } from '../state'; | ||
6 | import LoaderComponent from '../../../components/ui/Loader'; | ||
7 | |||
8 | const styles = () => ({ | ||
9 | wrapper: { | ||
10 | display: 'flex', | ||
11 | alignItems: 'flex-start', | ||
12 | position: 'absolute', | ||
13 | width: '100%', | ||
14 | marginTop: '20px', | ||
15 | }, | ||
16 | component: { | ||
17 | background: 'rgba(20, 20, 20, 0.4)', | ||
18 | padding: 20, | ||
19 | width: 'auto', | ||
20 | height: 'auto', | ||
21 | margin: [0, 'auto'], | ||
22 | borderRadius: 6, | ||
23 | alignItems: 'flex-start', | ||
24 | zIndex: 200, | ||
25 | }, | ||
26 | name: { | ||
27 | fontSize: 35, | ||
28 | marginBottom: '10px', | ||
29 | }, | ||
30 | }); | ||
31 | |||
32 | @injectSheet(styles) @observer | ||
33 | class WorkspaceSwitchingIndicator extends Component { | ||
34 | static propTypes = { | ||
35 | classes: PropTypes.object.isRequired, | ||
36 | }; | ||
37 | |||
38 | render() { | ||
39 | const { classes } = this.props; | ||
40 | const { isSwitchingWorkspace, nextWorkspace } = workspacesState; | ||
41 | if (!isSwitchingWorkspace) return null; | ||
42 | const nextWorkspaceName = nextWorkspace ? nextWorkspace.name : 'All services'; | ||
43 | return ( | ||
44 | <div className={classes.wrapper}> | ||
45 | <div className={classes.component}> | ||
46 | <h1 className={classes.name}> | ||
47 | {`Switching to ${nextWorkspaceName}`} | ||
48 | </h1> | ||
49 | <LoaderComponent /> | ||
50 | </div> | ||
51 | </div> | ||
52 | ); | ||
53 | } | ||
54 | } | ||
55 | |||
56 | export default WorkspaceSwitchingIndicator; | ||