Skip to content

Commit

Permalink
fix(pix-table): fix css condensed mode on pix-table
Browse files Browse the repository at this point in the history
  • Loading branch information
xav-car committed Mar 4, 2025
1 parent a6d4314 commit abd80cb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions addon/components/pix-table.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="pix-table" ...attributes>
<table class={{this.tableClass}}>
<div class={{this.tableClass}} ...attributes>
<table>
<caption class="screen-reader-only">{{this.caption}}</caption>
<thead class={{this.headerClass}}>
<tr>
Expand Down
6 changes: 4 additions & 2 deletions addon/components/pix-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default class PixTable extends Component {
}

get tableClass() {
const tableClass = ['pix-table'];
warn(
'PixTable: @condensed must be a boolean, default undefined',
[true, false, undefined].includes(this.args.condensed),
Expand All @@ -32,9 +33,10 @@ export default class PixTable extends Component {
},
);
if (this.args.condensed) {
return 'pix-table__condensed';
tableClass.push('pix-table--condensed');
}
return null;

return tableClass.join(' ');
}

get headerClass() {
Expand Down
14 changes: 8 additions & 6 deletions addon/styles/_pix-table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@

@extend %pix-body-s;

&__condensed {
th, td {
padding: var(--pix-spacing-2x) var(--pix-spacing-4x);
}
}

&__clickable-row {
cursor: pointer;

Expand Down Expand Up @@ -82,5 +76,13 @@
}
}
}

&--condensed {
table {
th, td {
padding: var(--pix-spacing-2x) var(--pix-spacing-4x);
}
}
}
}

0 comments on commit abd80cb

Please sign in to comment.