Skip to content

Commit

Permalink
Add a wrapping div around the rendered table to provide mobile respon…
Browse files Browse the repository at this point in the history
…siveness
  • Loading branch information
talldan committed Sep 17, 2018
1 parent 2fa1b81 commit 10b6ad5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 21 deletions.
4 changes: 2 additions & 2 deletions packages/block-library/src/table/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ export default class TableEdit extends Component {
);
}

const classes = classnames( className, {
const classes = classnames( {
'has-fixed-layout': hasFixedLayout,
} );

Expand Down Expand Up @@ -502,7 +502,7 @@ export default class TableEdit extends Component {
/>
</PanelBody>
</InspectorControls>
<div className="block-library-table__overflow_container">
<div className={ className }>
<table className={ classes } style={ getTableStyles( attributes ) }>
<Section type="head" rows={ head } />
<Section type="body" rows={ body } />
Expand Down
9 changes: 0 additions & 9 deletions packages/block-library/src/table/editor.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
.wp-block-table {
table {
border-collapse: collapse;
width: 100%;
}

td,
th {
padding: 0;
Expand All @@ -22,10 +17,6 @@
}
}

.block-library-table__overflow_container {
overflow: auto;
}

.block-library-table__dimensions__row {
display: flex;
}
Expand Down
12 changes: 7 additions & 5 deletions packages/block-library/src/table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,13 @@ export const settings = {
};

return (
<table className={ classes } style={ getTableStyles( attributes ) }>
<Section type="head" rows={ head } />
<Section type="body" rows={ body } />
<Section type="foot" rows={ foot } />
</table>
<div>
<table className={ classes } style={ getTableStyles( attributes ) }>
<Section type="head" rows={ head } />
<Section type="body" rows={ body } />
<Section type="foot" rows={ foot } />
</table>
</div>
);
},

Expand Down
5 changes: 3 additions & 2 deletions packages/block-library/src/table/style.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.wp-block-table {
// Fixed layout toggle
&.has-fixed-layout {
overflow-x: auto;

table.has-fixed-layout {
table-layout: fixed;
width: 100%;
}
Expand Down
8 changes: 5 additions & 3 deletions packages/block-library/src/table/theme.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
.wp-block-table {
width: 100%;
min-width: $break-mobile / 2;
border-collapse: collapse;
table {
width: 100%;
min-width: $break-mobile / 2;
border-collapse: collapse;
}

td,
th {
Expand Down

0 comments on commit 10b6ad5

Please sign in to comment.