forked from cerebral/overmind
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
40 lines (38 loc) · 1.2 KB
/
index.tsx
File metadata and controls
40 lines (38 loc) · 1.2 KB
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
import { Fragment, createElement, FunctionComponent } from 'react'
import { useOvermind } from '../../overmind'
import { getAppShortName, nameToColor } from '../../overmind/utils'
import * as styles from './styles'
import { css } from 'emotion'
const Apps: FunctionComponent = () => {
const { state, actions } = useOvermind()
return (
<div className={styles.wrapper}>
<div
className={styles.currentApp(nameToColor(state.currentAppName))}
onClick={actions.toggleShowApps}
>
{getAppShortName(state.currentAppName)}
</div>
{state.showApps ? (
<Fragment>
<div className={styles.overlay} onClick={actions.toggleShowApps} />
<div className={styles.appsList}>
{Object.keys(state.apps).map((appName) => (
<div
className={css(
styles.app,
state.currentAppName === appName && styles.appSelected
)}
key={appName}
onClick={() => actions.selectApp(appName)}
>
{appName}
</div>
))}
</div>
</Fragment>
) : null}
</div>
)
}
export default Apps