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
34 lines (31 loc) · 975 Bytes
/
index.tsx
File metadata and controls
34 lines (31 loc) · 975 Bytes
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
import { createElement, FunctionComponent } from 'react'
import * as styles from './styles'
import { useOvermind } from '../../overmind'
import { isValidJson } from '../../overmind/utils'
import { colors } from '../../theme'
const ActionPayload: FunctionComponent = () => {
const { state, actions } = useOvermind()
const payload = state.currentApp.actionQueryPayload
return (
<div className={styles.wrapper}>
<input
style={{
borderColor:
!payload || isValidJson(payload) ? 'transparent' : colors.red,
}}
disabled={!state.currentApp.selectedActionQuery}
placeholder={
state.currentApp.selectedActionQuery
? 'Add some JSON payload...'
: null
}
className={styles.input}
value={payload}
onChange={(event) =>
actions.setActionQueryPayload(event.currentTarget.value)
}
/>
</div>
)
}
export default ActionPayload