aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/src/Keyboard/Keys/KeyParamlist.js
blob: 58680bd373a1ce424652ccb8fd329d1099e04094 (plain)
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 get from 'lodash/get'
import KeyValue from './KeyValue'
import styles from './styles.module.css'

export default function KeyParamlist(props) {
  const { index, params, values, onSelect, root } = props
  return (
    <span
      className={styles.params}
      data-is-root={!!root}
      data-param-count={params.length}
    >
      {params.map((param, i) => (
        <span key={`param-${i}`} className={styles.param}>
          <KeyValue
            index={index.indexOf(values[i])}
            param={param}
            value={get(values[i], 'value')}
            source={get(values[i], 'source')}
            onSelect={onSelect}
          />
          {get(values[i], 'source.params.length') > 0 ? (
            <KeyParamlist
              index={index}
              params={get(values[i], 'source.params')}
              values={get(values[i], 'params')}
              onSelect={onSelect}
            />
          ) : null}
        </span>
      ))}
    </span>
  )
}