Skip to content

Commit

Permalink
fix IE11 compatibility issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Berney committed Aug 14, 2017
1 parent e5a6b3b commit 2abd149
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/pivotal-ui-react/iconography/iconography.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (<div {...props}>
Expand Down
13 changes: 10 additions & 3 deletions src/pivotal-ui-react/table/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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};
Expand All @@ -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});
Expand Down Expand Up @@ -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;
});

Expand Down

0 comments on commit 2abd149

Please sign in to comment.