Skip to content

Commit

Permalink
Fix React errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aputinski committed Dec 17, 2015
1 parent ae5ae80 commit 4e445aa
Showing 1 changed file with 21 additions and 36 deletions.
57 changes: 21 additions & 36 deletions app_modules/site/components/page/component/table-yaml/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,24 @@ import g from 'app_modules/global';

class TableYAML extends React.Component {

getRows() {
const { data } = this.props;

return (data.classes || []).map((d, dIndex) => {
renderRows() {
let classes = this.props.data.classes || [];
return classes.map((d, index) => {
let sanitizedClass = d.class.replace(/\W/g, '');
let required = null;
let notes = null;
let deprecated = null;

if (d.required) {
required = [
<p>
<SvgIcon key={`required-${dIndex}-icon`} className={pf('icon icon--x-small icon-text-default')} sprite="utility" symbol="check" />
<span key={`required-${dIndex}-asst`} className={pf('assistive-text')}>Required</span>
let required = d.required
? <p>
<SvgIcon key={`required-${index}-icon`} className={pf('icon icon--x-small icon-text-default')} sprite="utility" symbol="check" />
<span key={`required-${index}-asst`} className={pf('assistive-text')}>Required</span>
</p>
];
} else {
required = [
<p>No, optional element or modifier</p>
];
}
if (d.notes) {
notes = [
<p dangerouslySetInnerHTML={{__html: d.notes}} />
];
} else {
notes = [
<p>--</p>
];
}
if (d.deprecated) {
deprecated = [
<span className={pf('badge shrink-none align-middle badge--deprecated')}>Deprecated</span>
];
}
return <tr key={`tableyaml-${sanitizedClass}-${dIndex}`}>
: <p>No, optional element or modifier</p>;
let notes = d.notes
? <p dangerouslySetInnerHTML={{__html: d.notes}} />
: <p>--</p>;
let deprecated = d.deprecated
? <span className={pf('badge shrink-none align-middle badge--deprecated')}>Deprecated</span>
: null;
return (
<tr key={`tableyaml-${sanitizedClass}-${index}`}>
<th className={pf('cell-shrink align-top')} scope="row">
<CodeClass className={d.class} />
<div>
Expand All @@ -71,7 +53,8 @@ class TableYAML extends React.Component {
<strong>Comments:</strong>
{notes}
</td>
</tr>;
</tr>
);
});
}

Expand All @@ -90,7 +73,9 @@ class TableYAML extends React.Component {
<th colSpan="2" className={pf('theme--shade')}>Usage</th>
</tr>
</thead>
{this.getRows()}
<tbody>
{this.renderRows()}
</tbody>
</table>
</div>
</div>;
Expand Down

0 comments on commit 4e445aa

Please sign in to comment.