Skip to content

Commit

Permalink
Allowing cells in mobile view to be explicitly 100% wide
Browse files Browse the repository at this point in the history
- Added `isMobileFullWidth` as a prop to `EuiTableRowCell`
  • Loading branch information
cchaos committed Mar 28, 2018
1 parent cc681ec commit cf3ceb5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src-docs/src/components/guide_section/guide_section.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export class GuideSection extends Component {
}
const cells = [
(
<EuiTableRowCell key="name" header="Prop">
<EuiTableRowCell key="name" header="Prop" isMobileHeader={true}>
{humanizedName}
</EuiTableRowCell>
), (
Expand All @@ -198,7 +198,7 @@ export class GuideSection extends Component {
{defaultValueMarkup}
</EuiTableRowCell>
), (
<EuiTableRowCell key="description" header="Note">
<EuiTableRowCell key="description" header="Note" isMobileFullWidth={true}>
{descriptionMarkup}
</EuiTableRowCell>
)
Expand Down
4 changes: 4 additions & 0 deletions src/components/table/mobile/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@
padding-top: $euiSizeXS;
}
}

&.euiTableRowCell--isMobileFullWidth {
width: 100%;
}
}

.euiTableRowCellCheckbox {
Expand Down
3 changes: 3 additions & 0 deletions src/components/table/table_row_cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ export const EuiTableRowCell = ({
header,
hideForMobile,
isMobileHeader,
isMobileFullWidth,
hasActions,
...rest
}) => {
const cellClasses = classNames('euiTableRowCell', {
'euiTableRowCell--hideForMobile': hideForMobile,
'euiTableRowCell--isMobileHeader': isMobileHeader,
'euiTableRowCell--hasActions': hasActions,
'euiTableRowCell--isMobileFullWidth': isMobileFullWidth,
});

const contentClasses = classNames('euiTableCellContent', className, {
Expand Down Expand Up @@ -65,6 +67,7 @@ EuiTableRowCell.propTypes = {
header: PropTypes.string,
hideForMobile: PropTypes.bool,
isMobileHeader: PropTypes.bool,
isMobileFullWidth: PropTypes.bool,
};

EuiTableRowCell.defaultProps = {
Expand Down

0 comments on commit cf3ceb5

Please sign in to comment.