diff --git a/src/pivotal-ui-react/iconography/iconography.js b/src/pivotal-ui-react/iconography/iconography.js index c36f7fc14..3c2110a44 100644 --- a/src/pivotal-ui-react/iconography/iconography.js +++ b/src/pivotal-ui-react/iconography/iconography.js @@ -35,7 +35,7 @@ export class Icon extends React.Component { const {src, verticalAlign, ...others} = this.props; const props = mergeProps( others, - {className: classnames('icon', `icon-${verticalAlign}`, {'spinner': src.startsWith('spinner')})} + {className: classnames('icon', `icon-${verticalAlign}`, {'spinner': src.indexOf('spinner') === 0})} ); return (
diff --git a/src/pivotal-ui-react/table/table.js b/src/pivotal-ui-react/table/table.js index 9a55aa9bb..ea0bdfe19 100644 --- a/src/pivotal-ui-react/table/table.js +++ b/src/pivotal-ui-react/table/table.js @@ -30,6 +30,13 @@ const SORT_ORDER = { none: 2 }; +function find(arr, cb) { + for (let i = 0; i < arr.length; i++) { + if (cb(arr[i])) return arr[i]; + } +} + + export class Table extends React.Component { static propTypes = { bodyRowClassName: PropTypes.string, @@ -44,7 +51,7 @@ export class Table extends React.Component { super(props, context); const {columns, defaultSort} = props; - const sortColumn = columns.find(({sortable, attribute}) => { + const sortColumn = find(columns, ({sortable, attribute}) => { return defaultSort ? attribute === defaultSort : sortable; }); this.state = {sortColumn, sortOrder: SORT_ORDER.asc}; @@ -55,7 +62,7 @@ export class Table extends React.Component { componentWillReceiveProps({columns, defaultSort}) { if (columns) { - const sortColumn = columns.find(({sortable, attribute}) => { + const sortColumn = find(columns, ({sortable, attribute}) => { return defaultSort ? attribute === defaultSort : sortable; }); this.setState({sortColumn, sortOrder: SORT_ORDER.asc}); @@ -190,7 +197,7 @@ export class FlexTable extends Table { super(props, context); const {columns, defaultSort} = props; - const sortColumn = columns.find(({sortable, attribute}) => { + const sortColumn = find(columns, ({sortable, attribute}) => { return defaultSort ? attribute === defaultSort : sortable; });