Skip to content

Commit

Permalink
feat(table): base column count on content
Browse files Browse the repository at this point in the history
  • Loading branch information
brentswisher committed Jan 10, 2025
1 parent a80b3cf commit 2ed1647
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 38 deletions.
75 changes: 37 additions & 38 deletions packages/pharos/src/components/table/pharos-table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
display: grid;

// grid-template-columns: auto auto auto auto auto; /* Define three equal columns */
grid-template-columns: repeat(5, max-content);
border-collapse: collapse;
gap: 1px;
}
Expand Down Expand Up @@ -69,45 +68,45 @@
// padding: var(--pharos-spacing-1-x);
// }

// .table-sticky-header {
// position: sticky;
// top: 0;
// }
.table-sticky-header {
position: sticky;
top: 0;
}

// .table-sticky-header--is-active {
// box-shadow: var(--pharos-elevation-level-2);
// }
.table-sticky-header--is-active {
box-shadow: var(--pharos-elevation-level-2);
}

// .table-sticky-header__cell--is-active {
// border: none;
// border-right: 1px solid var(--pharos-table-header-color-border, var(--pharos-color-ui-30));
.table-sticky-header__cell--is-active {
border: none;
border-right: 1px solid var(--pharos-table-header-color-border, var(--pharos-color-ui-30));

// &:last-child {
// border-right: none;
// }
// }
&:last-child {
border-right: none;
}
}

// .table-controls {
// display: flex;
// justify-content: space-between;
// align-items: center;
// margin-top: var(--pharos-spacing-one-half-x);

// .item-per-page-wrapper {
// display: flex;
// align-items: center;
// column-gap: var(--pharos-spacing-one-half-x);

// .item-per-page-selector {
// width: 75px;
// }
// }

// .pagination {
// height: var(--pharos-spacing-one-and-a-half-x);
// }
// }
.table-controls {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: var(--pharos-spacing-one-half-x);

// .visually-hidden:not(:focus, :active) {
// @include mixins.hidden;
// }
.item-per-page-wrapper {
display: flex;
align-items: center;
column-gap: var(--pharos-spacing-one-half-x);

.item-per-page-selector {
width: 75px;
}
}

.pagination {
height: var(--pharos-spacing-one-and-a-half-x);
}
}

.visually-hidden:not(:focus, :active) {
@include mixins.hidden;
}
5 changes: 5 additions & 0 deletions packages/pharos/src/components/table/pharos-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ export class PharosTable extends ScopedRegistryMixin(PharosElement) {
protected override render(): TemplateResult {
//TODO: Add caption and hideCaption
return html`
<style>
.grid {
grid-template-columns: repeat(${this.columns.length}, max-content);
}
</style>
<div class="grid" role="grid">
<div class="grid-caption">An example table</div>
<div class="grid-header" role="rowgroup">
Expand Down

0 comments on commit 2ed1647

Please sign in to comment.