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

Commit

Permalink
Enable grid cells
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixHenninger committed Aug 18, 2020
1 parent 07c214f commit 8e3fd6e
Showing 1 changed file with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
import React from 'react'
import React, { Fragment } from 'react'

export default () => <p>Foo bar</p>
import { FastField, useFormikContext } from 'formik'

import { Table, DefaultRow } from '../../../../../Form/table'

const Row = ({ index: rowIndex, name, data, arrayHelpers }) =>
<DefaultRow
index={ rowIndex } arrayHelpers={ arrayHelpers }
wrapper={ Fragment }
>
{ data.map(
(_, columnIndex) =>
<td key={ `${ name }[${ columnIndex }]` }>
<FastField
name={ `${ name }[${ columnIndex }]` }
className="form-control text-monospace"
/>
</td>
) }
</DefaultRow>

export default () => {
const { values } = useFormikContext()
const { templateParameters } = values

return <Table
name="templateParameters.rows"
row={ Row }
columns={ templateParameters.columns.length }
className="border-top-0"
/>
}

0 comments on commit 8e3fd6e

Please sign in to comment.