Skip to content

Commit

Permalink
fix(flat-table-cell, flat-table-header): raise specificity of spacing…
Browse files Browse the repository at this point in the history
… styles

Raises specificity of the `space` styles applied to div container within `FlatTableCell` and
`FlatTableHeader` so any values passed via `styled-system` props take precedence of the cell-sizes
configs

fix #3846
  • Loading branch information
edleeks87 committed Apr 13, 2021
1 parent 60a5748 commit 8bd10ce
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ exports[`FlatTable when rendered with proper table data should have expected str
padding-left: 1px;
}
.c10 > div {
.c9.c9.c9 > div {
box-sizing: border-box;
}
Expand All @@ -39,7 +39,7 @@ exports[`FlatTable when rendered with proper table data should have expected str
padding: 0;
}
.c12 > div {
.c11.c11.c11 > div {
box-sizing: border-box;
}
Expand All @@ -62,7 +62,7 @@ exports[`FlatTable when rendered with proper table data should have expected str
padding: 0;
}
.c13 > div {
.c12.c12.c12 > div {
box-sizing: border-box;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ const StyledFlatTableCell = styled.td`
white-space: nowrap;
padding: 0;
> div {
box-sizing: border-box;
${space}
&&& {
> div {
box-sizing: border-box;
${space}
}
}
&:first-of-type {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("FlatTableHeader", () => {
width: "40px",
},
wrapper.find(StyledFlatTableHeader),
{ modifier: " > div" }
{ modifier: "&&& > div" }
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@ const StyledFlatTableHeader = styled.th`
padding-left: 1px;
}
> div {
box-sizing: border-box;
${space}
${colWidth &&
css`
width: ${colWidth}px;
`}
&&& {
> div {
box-sizing: border-box;
${space}
${colWidth &&
css`
width: ${colWidth}px;
`}
}
}
${makeCellSticky &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe("FlatTableRowHeader", () => {
(props) => <FlatTableRowHeader {...props} />,
{ py: "10px", px: 3 },
null,
{ modifier: " > div" }
{ modifier: "&&& > div" }
);

it("renders with proper width style rule when width prop is passed", () => {
Expand All @@ -31,7 +31,7 @@ describe("FlatTableRowHeader", () => {
width: "40px",
},
wrapper.find(StyledFlatTableRowHeader),
{ modifier: " > div" }
{ modifier: "&&& > div" }
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@ const StyledFlatTableRowHeader = styled.th`
width: ${colWidth}px;
`}
> div {
box-sizing: border-box;
${colWidth &&
css`
width: ${colWidth}px;
`}
${space}
}
&&& {
left: ${leftPosition}px;
> div {
box-sizing: border-box;
${colWidth &&
css`
width: ${colWidth}px;
`}
${space}
}
}
`}
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports[`FlatTableRow should have expected styles 1`] = `
padding: 0;
}
.c1 > div {
.c1.c1.c1 > div {
box-sizing: border-box;
}
Expand Down

0 comments on commit 8bd10ce

Please sign in to comment.