Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fe): adjust search table column widths #1301

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 58 additions & 13 deletions frontend/src/assets/styles/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@
//Layout
--header-height: 3.5rem;

//Data-table
--col-padding-rem: 1.5;

/*
The expected width of the scroll bar.
While this might not match the real value, it should help to make a rough adjustment, at least.
Expand Down Expand Up @@ -1490,25 +1493,66 @@ cds-table-header-cell {
background: var(--light-theme-layer-accent-layer-accent-01, #dfdfe1);
}

.col-6_75rem {
width: 6.75rem;
}
#search-table {
fterra-encora marked this conversation as resolved.
Show resolved Hide resolved
width: 100%;
min-width: 63rem;

.col-19_4375rem {
width: 19.4375rem;
}
/*
Sizes come from designed widths in rem minus their padding, where screen width is 1584px and
table width is 1328px.
*/
--col-6_75-rem: 6.75;
--col-19_4375-rem: 19.4375;
--col-14_75-rem: 14.75;
--col-7_0625-rem: 7.0625;

--padding-fixed-rem: 1;

--total: calc(
var(--col-padding-rem)
+ var(--col-6_75-rem) + 2 * var(--padding-fixed-rem)
+ var(--col-6_75-rem) + 2 * var(--padding-fixed-rem)
+ var(--col-19_4375-rem) + 2 * var(--padding-fixed-rem)
+ var(--col-14_75-rem) + 2 * var(--padding-fixed-rem)
+ var(--col-14_75-rem) + 2 * var(--padding-fixed-rem)
+ var(--col-7_0625-rem) + 2 * var(--padding-fixed-rem)
);

.col-14_75rem {
width: 14.75rem;
}
--col-status-rem: 5.75;

/*
Border-box allows to keep calculations simple, regardless of the padding, while keeping the
padding width always the same.
*/
cds-table-header-cell {
box-sizing: border-box;
}

/*
Each column width below is a percentage proportional to the corresponding designed value, so it
can adjust responsively.
*/

.col-7_0625rem {
width: 7.0625rem;
.col-6_75 {
width: calc( 100% * (var(--col-6_75-rem) + 2 * var(--padding-fixed-rem)) / var(--total));
}

.col-19_4375 {
width: calc( 100% * (var(--col-19_4375-rem) + 2 * var(--padding-fixed-rem)) / var(--total));
}

.col-14_75 {
width: calc( 100% * (var(--col-14_75-rem) + 2 * var(--padding-fixed-rem)) / var(--total));
}

.col-7_0625 {
width: calc( 100% * (var(--col-7_0625-rem) + 2 * var(--padding-fixed-rem)) / var(--total));
}
}

.padding-column {
.col-padding {
padding: 0;
width: 1.5rem;
width: calc(var(--col-padding-rem) * 1rem);
}

cds-pagination {
Expand All @@ -1520,6 +1564,7 @@ cds-pagination {

cds-tag {
margin: 0;
word-break: normal;
}

cds-header-panel[expanded] {
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/pages/SearchPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,13 @@ onMounted(() => {
<cds-table id="search-table" use-zebra-styles v-if="!loadingSearch">
<cds-table-head>
<cds-table-header-row>
<cds-table-header-cell class="padding-column" />
<cds-table-header-cell class="col-6_75rem">Client number</cds-table-header-cell>
<cds-table-header-cell class="col-6_75rem">Acronym</cds-table-header-cell>
<cds-table-header-cell class="col-19_4375rem">Name</cds-table-header-cell>
<cds-table-header-cell class="col-14_75rem">Type</cds-table-header-cell>
<cds-table-header-cell class="col-14_75rem">City</cds-table-header-cell>
<cds-table-header-cell class="col-7_0625rem">Status</cds-table-header-cell>
<cds-table-header-cell class="col-padding" />
<cds-table-header-cell class="col-6_75">Client number</cds-table-header-cell>
<cds-table-header-cell class="col-6_75">Acronym</cds-table-header-cell>
<cds-table-header-cell class="col-19_4375">Name</cds-table-header-cell>
<cds-table-header-cell class="col-14_75">Type</cds-table-header-cell>
<cds-table-header-cell class="col-14_75">City</cds-table-header-cell>
<cds-table-header-cell class="col-7_0625">Status</cds-table-header-cell>
</cds-table-header-row>
</cds-table-head>
<cds-table-body>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/SubmissionListPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,13 @@ const summitSvg = useSvg(summit);
<cds-table id="submissions-table" use-zebra-styles v-if="!loading">
<cds-table-head>
<cds-table-header-row>
<cds-table-header-cell class="padding-column" />
<cds-table-header-cell class="col-padding" />
<cds-table-header-cell>Client name</cds-table-header-cell>
<cds-table-header-cell>Client type</cds-table-header-cell>
<cds-table-header-cell>District</cds-table-header-cell>
<cds-table-header-cell>Submitted on</cds-table-header-cell>
<cds-table-header-cell>Submission status</cds-table-header-cell>
<cds-table-header-cell class="padding-column" />
<cds-table-header-cell class="col-padding" />
</cds-table-header-row>
</cds-table-head>
<cds-table-body>
Expand Down
Loading