Skip to content

Commit

Permalink
feat(Table.HeaderCell): sorted={false} is now supported to simplify y…
Browse files Browse the repository at this point in the history
…our JSX logic
  • Loading branch information
jayphelps committed Jun 5, 2017
1 parent 100c246 commit 6a690e0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/collections/Table/TableHeaderCell.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ export interface TableHeaderCellProps extends TableCellProps {
/** Additional classes. */
className?: string;

/** A header cell can be sorted in ascending or descending order. */
sorted?: 'ascending' | 'descending';
/**
* A header cell can be sorted in ascending or descending order, but we also
* allow the literal `false`
*/
sorted?: 'ascending' | 'descending' | false;
}

declare const TableHeaderCell: React.StatelessComponent<TableHeaderCellProps>;
Expand Down
7 changes: 5 additions & 2 deletions src/collections/Table/TableHeaderCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ TableHeaderCell.propTypes = {
/** Additional classes. */
className: PropTypes.string,

/** A header cell can be sorted in ascending or descending order. */
sorted: PropTypes.oneOf(['ascending', 'descending']),
/**
* A header cell can be sorted in ascending or descending order, but we also
* allow the literal `false`
*/
sorted: PropTypes.oneOf(['ascending', 'descending', false]),
}

TableHeaderCell.defaultProps = {
Expand Down
2 changes: 1 addition & 1 deletion test/specs/collections/Table/TableHeaderCell-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import TableHeaderCell from 'src/collections/Table/TableHeaderCell'

describe('TableHeaderCell', () => {
common.isConformant(TableHeaderCell)
common.propKeyAndValueToClassName(TableHeaderCell, 'sorted', ['ascending', 'descending'])
common.propKeyAndValueToClassName(TableHeaderCell, 'sorted', ['ascending', 'descending', false])

it('renders as a th by default', () => {
shallow(<TableHeaderCell />)
Expand Down

0 comments on commit 6a690e0

Please sign in to comment.