Skip to content

Commit

Permalink
fix(Table): Use direct imports instead of spread (patternfly#1237)
Browse files Browse the repository at this point in the history
* fix(Table): Use direct imports instead of spread

* Do not show selects for collapsed rows
  • Loading branch information
karelhala authored and dgutride committed Jan 30, 2019
1 parent 6721ae5 commit e799809
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ContextBody extends React.Component {
})
},
{ id: oneRowKey }),
...oneRow.parent ? {
...oneRow.parent !== undefined ? {
isExpanded: this.parentsExpanded(oneRow.parent) && rows[oneRow.parent].isOpen
} : {},
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { css } from '@patternfly/react-styles';
import { tableExpandableRowContent } from '@patternfly/patternfly-next/components/Table/table.css';
import styles from '@patternfly/patternfly-next/components/Table/table.css';

const propTypes = {
children: PropTypes.node
Expand All @@ -11,7 +11,7 @@ const defaultProps = {
};

const ExpandableRowContent = ({ children, className, ...props }) => (
<div {...props} className={css(tableExpandableRowContent)}>
<div {...props} className={css(styles.tableExpandableRowContent)}>
{children}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import PropsType from 'prop-types';
import { tableExpandableRow, modifiers } from '@patternfly/patternfly-next/components/Table/table.css';
import styles from '@patternfly/patternfly-next/components/Table/table.css';
import { css } from '@patternfly/react-styles';

const RowWrapper = ({ isOpen, isExpanded, ...props }) => {
return <tr {...props}
className={css(isExpanded !== undefined && tableExpandableRow, isExpanded && modifiers.expanded)}
className={css(isExpanded !== undefined && styles.tableExpandableRow, isExpanded && styles.modifiers.expanded)}
hidden={isExpanded !== undefined && !isExpanded}
/>;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { css } from '@patternfly/react-styles';
import { checkInput } from '@patternfly/patternfly-next/components/Check/check.css';
import styles from '@patternfly/patternfly-next/components/Check/check.css';

const propTypes = {
children: PropTypes.node,
Expand All @@ -16,7 +16,7 @@ const defaultProps = {

const SelectColumn = ({ children, className, onSelect, ...props }) => (
<React.Fragment>
<input {...props} className={css(checkInput)} type="checkbox" onChange={onSelect}></input>
<input {...props} className={css(styles.checkInput)} type="checkbox" onChange={onSelect}></input>
{children}
</React.Fragment>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { AngleUpIcon, SortIcon } from '@patternfly/react-icons';
import { css } from '@patternfly/react-styles';
import { tableSortIndicator } from '@patternfly/patternfly-next/components/Table/table.css';
import styles from '@patternfly/patternfly-next/components/Table/table.css';

const propTypes = {
children: PropTypes.node,
Expand All @@ -27,7 +27,7 @@ const SortColumn = ({ isSortedBy, children, className, onSort, ...props }) => {
return (
<button {...props} className={css(className)} onClick={event => onSort && onSort(event)}>
{children}
<span className={css(tableSortIndicator)}>
<span className={css(styles.tableSortIndicator)}>
<SortedByIcon />
</span>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const propTypes = {
cells: PropTypes.arrayOf(PropTypes.node),
isOpen: PropTypes.bool,
parent: PropTypes.number,
showSelect: PropTypes.bool,
props: PropTypes.any
}),
PropTypes.arrayOf(PropTypes.oneOfType([
Expand Down
Loading

0 comments on commit e799809

Please sign in to comment.