Skip to content

Commit 7735942

Browse files
authored
Merge pull request #566 from GSA/IAEMOD-3525
Fix NGX-USWDS table appearance when sam-styles applied
2 parents 2b7c686 + 488bf07 commit 7735942

1 file changed

Lines changed: 96 additions & 70 deletions

File tree

src/stylesheets/components/_table.scss

Lines changed: 96 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -161,96 +161,103 @@ $sds-table-border: "1px";
161161
}
162162
}
163163
}
164-
tr{
165-
height: 3rem;
166-
}
167-
&--compact{
168-
tr{
169-
height: 100%;
164+
@include at-media("tablet") {
165+
tr {
166+
height: 3rem;
170167
}
171-
}
172168

173-
&:not(.usa-table--borderless):not(.sds-tree-table) {
174-
thead{
175-
th,td {
176-
/**
177-
Overrides remaining borders to ensure correct color and width.
178-
Must include :not(.mat-header-cell) in order to prevent a 2 px border from forming when sds-table extends usa-table
179-
*/
180-
&:first-child:not(.mat-header-cell){
181-
@include u-border-left('base-light', $sds-table-border);
182-
}
183-
&:last-child:not(.mat-header-cell){
184-
@include u-border-right('base-light', $sds-table-border);
185-
}
186-
&:not(.mat-header-cell){
187-
@include u-border-top('base-light', $sds-table-border);
188-
}
169+
&--compact {
170+
tr {
171+
height: 100%;
189172
}
190173
}
191-
tbody{
192-
tr{
193-
&:last-child{
194-
td:not(.mat-cell) {
195-
@include u-border-bottom('base-light', $sds-table-border);
174+
}
175+
176+
&:not(.usa-table--borderless):not(.sds-tree-table) {
177+
@include at-media("tablet") {
178+
thead{
179+
th,td {
180+
/**
181+
Overrides remaining borders to ensure correct color and width.
182+
Must include :not(.mat-header-cell) in order to prevent a 2 px border from forming when sds-table extends usa-table
183+
*/
184+
&:first-child:not(.mat-header-cell){
185+
@include u-border-left('base-light', $sds-table-border);
196186
}
197-
}
198-
th,td{
199-
&:first-child:not(.mat-cell){
200-
@include u-border-left('base-light', $sds-table-border);
187+
&:last-child:not(.mat-header-cell){
188+
@include u-border-right('base-light', $sds-table-border);
201189
}
202-
&:last-child:not(.mat-cell){
203-
@include u-border-right('base-light', $sds-table-border);
190+
&:not(.mat-header-cell){
191+
@include u-border-top('base-light', $sds-table-border);
204192
}
205193
}
206194
}
207-
}
208-
}
209-
210-
thead {
211-
th, td {
212-
/**
213-
Removes internal borders so that only borders on the outside edges of header remain
214-
*/
215-
&:not(:first-child){
216-
border-left: 0px;
217-
}
218-
&:not(:last-child){
219-
border-right: 0px;
220-
}
221-
&:not(.mat-header-cell){
222-
@include u-border-bottom('base-light', $sds-table-border);
195+
tbody{
196+
tr{
197+
&:last-child{
198+
td:not(.mat-cell) {
199+
@include u-border-bottom('base-light', $sds-table-border);
200+
}
201+
}
202+
th,td{
203+
&:first-child:not(.mat-cell){
204+
@include u-border-left('base-light', $sds-table-border);
205+
}
206+
&:last-child:not(.mat-cell){
207+
@include u-border-right('base-light', $sds-table-border);
208+
}
209+
}
210+
}
223211
}
224-
padding-bottom: 0.5rem;
225-
padding-top: 0.5rem;
226-
padding-left: 1.5rem;
227-
padding-right: 1rem;
228-
background-color: color($theme-table-header-background-color);
229-
230212
}
231213
}
232-
tbody {
233-
tr{
214+
@include at-media("tablet") {
215+
thead {
234216
th, td {
217+
/**
218+
Removes internal borders so that only borders on the outside edges of header remain
219+
*/
220+
&:not(:first-child){
221+
border-left: 0px;
222+
}
223+
&:not(:last-child){
224+
border-right: 0px;
225+
}
226+
&:not(.mat-header-cell){
227+
@include u-border-bottom('base-light', $sds-table-border);
228+
}
235229
padding-bottom: 0.5rem;
236230
padding-top: 0.5rem;
237231
padding-left: 1.5rem;
238232
padding-right: 1rem;
239-
240-
/**
241-
Removing internal horizontal borders from rows that divide the body into rows
242-
*/
243-
border-bottom: 0px;
244-
border-top: 0px;
245-
246-
/**
247-
Removing internal vertical borders from cells that divide the rows into columns
248-
*/
249-
border-left: 0px;
250-
border-right: 0px;
233+
background-color: color($theme-table-header-background-color);
234+
235+
}
236+
}
237+
tbody {
238+
tr{
239+
th, td {
240+
padding-bottom: 0.5rem;
241+
padding-top: 0.5rem;
242+
padding-left: 1.5rem;
243+
padding-right: 1rem;
244+
245+
/**
246+
Removing internal horizontal borders from rows that divide the body into rows
247+
*/
248+
border-bottom: 0px;
249+
border-top: 0px;
250+
251+
/**
252+
Removing internal vertical borders from cells that divide the rows into columns
253+
*/
254+
border-left: 0px;
255+
border-right: 0px;
256+
}
251257
}
252258
}
253259
}
260+
254261
&--striped {
255262
tbody {
256263
tr:nth-child(even) {
@@ -273,4 +280,23 @@ $sds-table-border: "1px";
273280
background-color: color($theme-table-header-background-color);
274281
}
275282
}
283+
&--stacked,
284+
&--stacked-header {
285+
@include at-media-max("mobile-lg") {
286+
td:not(:first-child) {
287+
border-top-width: 0px;
288+
}
289+
}
290+
}
291+
&--stacked-header {
292+
@include at-media-max("mobile-lg") {
293+
tr{
294+
td{
295+
&:first-child{
296+
padding-left: 0.75rem;
297+
}
298+
}
299+
}
300+
}
301+
}
276302
}

0 commit comments

Comments
 (0)