Refactor key value table to accept data content as a property

[MAILPOET-1517]
This commit is contained in:
Rostislav Wolny
2018-09-03 16:58:46 +02:00
parent 571f39de08
commit 1e5ad9d5cd
3 changed files with 67 additions and 62 deletions

View File

@@ -3,7 +3,7 @@ import React from 'react';
const KeyValueTable = props => (
<table className={'widefat fixed'} style={{ maxWidth: props.max_width }}>
<tbody>
{props.children.map(row => (
{props.rows.map(row => (
<tr key={`row_${row.key}`}>
<td className={'row-title'}>{ row.key }</td><td>{ row.value }</td>
</tr>
@@ -14,7 +14,7 @@ const KeyValueTable = props => (
KeyValueTable.propTypes = {
max_width: React.PropTypes.string,
children: React.PropTypes.arrayOf(React.PropTypes.shape({
rows: React.PropTypes.arrayOf(React.PropTypes.shape({
key: React.PropTypes.string.isRequired,
value: React.PropTypes.oneOfType([
React.PropTypes.string,