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
63 lines (60 loc) · 1.97 KB
/
index.tsx
File metadata and controls
63 lines (60 loc) · 1.97 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { createElement, SFC } from 'react'
import { useOvermind } from '../../overmind'
import { Flush as FlushType } from '../../overmind/types'
import * as actionStyles from '../Action/styles'
import * as styles from './styles'
import * as textStyles from '../../styles/text'
import Path from '../ActionPath'
import Icon from '../common/Icon'
type Props = {
flush: FlushType
}
const ActionFlush: SFC<Props> = ({ flush }) => {
const { state, actions } = useOvermind()
const isExpanded = state.expandAllActionDetails || !flush.isCollapsed
return (
<div className={actionStyles.pipe}>
<Path />
<div className={styles.flush}>
<div
className={styles.flushHeader}
onClick={() => actions.toggleCollapsedFlush(flush.flushId)}
>
<span className={textStyles.hint}>
<Icon>code</Icon> {flush.components.length}
</span>
<span className={textStyles.hint}>
<Icon>chain</Icon> {flush.derived.length}
</span>
{flush.components.length || flush.derived.length ? (
<span className={textStyles.hint}>
{isExpanded ? <Icon>chevron-down</Icon> : <Icon>chevron-up</Icon>}
</span>
) : (
<span className={textStyles.hint} />
)}
</div>
{isExpanded ? (
<div>
{flush.components.map((componentId) => (
<div key={componentId}>
<span className={textStyles.hint}>
<Icon>code</Icon>{' '}
{state.currentApp.components[componentId].name}
</span>
</div>
))}
{flush.derived.map((derivedPath) => (
<div key={derivedPath}>
<span className={textStyles.hint}>
<Icon>chain</Icon> {derivedPath}
</span>
</div>
))}
</div>
) : null}
</div>
</div>
)
}
export default ActionFlush