Skip to content
This repository was archived by the owner on Nov 22, 2022. It is now read-only.

Commit 8e3fd6e

Browse files
Enable grid cells
1 parent 07c214f commit 8e3fd6e

File tree

1 file changed

+32
-2
lines changed
  • packages/builder/src/components/ComponentOptions/components/Content/Loop/Grid

1 file changed

+32
-2
lines changed
Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1-
import React from 'react'
1+
import React, { Fragment } from 'react'
22

3-
export default () => <p>Foo bar</p>
3+
import { FastField, useFormikContext } from 'formik'
4+
5+
import { Table, DefaultRow } from '../../../../../Form/table'
6+
7+
const Row = ({ index: rowIndex, name, data, arrayHelpers }) =>
8+
<DefaultRow
9+
index={ rowIndex } arrayHelpers={ arrayHelpers }
10+
wrapper={ Fragment }
11+
>
12+
{ data.map(
13+
(_, columnIndex) =>
14+
<td key={ `${ name }[${ columnIndex }]` }>
15+
<FastField
16+
name={ `${ name }[${ columnIndex }]` }
17+
className="form-control text-monospace"
18+
/>
19+
</td>
20+
) }
21+
</DefaultRow>
22+
23+
export default () => {
24+
const { values } = useFormikContext()
25+
const { templateParameters } = values
26+
27+
return <Table
28+
name="templateParameters.rows"
29+
row={ Row }
30+
columns={ templateParameters.columns.length }
31+
className="border-top-0"
32+
/>
33+
}

0 commit comments

Comments
 (0)