Tweak New Transaction - Items page styles so content fits on narrow screens
All checks were successful
Docker Image CI / build (push) Successful in 3m5s

This commit is contained in:
James Chapman 2024-10-14 18:26:07 +01:00
parent e5478a426b
commit 79850c46b5
Signed by: jamsch0
GPG Key ID: 765FE58130277547
4 changed files with 44 additions and 6 deletions

View File

@ -176,6 +176,12 @@
{ {
string?[] classes = [ string?[] classes = [
"table__header", "table__header",
column.Align switch
{
Align.Center => "table__header--align-center",
Align.End => "table__header--align-end",
_ => null,
},
column.Sortable ? "table__header--sortable" : null, column.Sortable ? "table__header--sortable" : null,
HeaderClass, HeaderClass,
]; ];

View File

@ -33,10 +33,10 @@
</div> </div>
<div class="card__content card__content--table"> <div class="card__content card__content--table">
<Table Items="Transaction.Items.AsQueryable()" CellClass="table__cell--compact"> <Table Items="Transaction.Items.AsQueryable()" HeaderClass="table__header--compact" CellClass="table__cell--compact">
<ChildContent> <ChildContent>
<TemplateTableColumn Title="Name" Fill="true" Context="item"> <TemplateTableColumn Title="Name" Fill="true" Context="item">
@itemNames.GetValueOrDefault(item.ItemId) <div class="line-clamp-4">@itemNames.GetValueOrDefault(item.ItemId)</div>
</TemplateTableColumn> </TemplateTableColumn>
<PropertyTableColumn Property="i => i.Price" CompositeFormat='i => i.Unit == null ? "{0:c}" : ("{0:c}/" + i.Unit)' /> <PropertyTableColumn Property="i => i.Price" CompositeFormat='i => i.Unit == null ? "{0:c}" : ("{0:c}/" + i.Unit)' />
<PropertyTableColumn Property="i => i.Quantity" CompositeFormat='i => i.Unit == null ? "{0:f0}" : ("{0:f3}" + i.Unit)'> <PropertyTableColumn Property="i => i.Quantity" CompositeFormat='i => i.Unit == null ? "{0:f0}" : ("{0:f3}" + i.Unit)'>

View File

@ -23,7 +23,7 @@
</header> </header>
<div class="card__content card__content--table"> <div class="card__content card__content--table">
<Table Items="Transaction.Promotions.AsQueryable()" CellClass="table__cell--compact"> <Table Items="Transaction.Promotions.AsQueryable()" HeaderClass="table__header--compact" CellClass="table__cell--compact">
<ChildContent> <ChildContent>
<PropertyTableColumn Property="p => p.Name" Fill="true" /> <PropertyTableColumn Property="p => p.Name" Fill="true" />
<TemplateTableColumn Title="Items" Align="Align.End" Context="promotion"> <TemplateTableColumn Title="Items" Align="Align.End" Context="promotion">

View File

@ -69,6 +69,14 @@ h1, h2, h3, h4, h5, h6 {
flex: 5; flex: 5;
} }
.line-clamp-4 {
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 4;
white-space: initial;
}
.row { .row {
display: flex; display: flex;
align-items: baseline; align-items: baseline;
@ -312,6 +320,12 @@ html:has(.modal[open]) {
border-color: transparent; border-color: transparent;
} }
@media (max-width: 40rem) {
.card__header, .card__footer {
padding-inline: 1rem;
}
}
/* Table */ /* Table */
.table { .table {
@ -374,15 +388,15 @@ html:has(.modal[open]) {
white-space: nowrap; white-space: nowrap;
} }
.table__cell--align-center { .table__header--align-center, .table__cell--align-center {
text-align: center; text-align: center;
} }
.table__cell--align-end { .table__header--align-end, .table__cell--align-end {
text-align: end; text-align: end;
} }
.table__cell--compact { .table__header--compact, .table__cell--compact {
line-height: 1rem; line-height: 1rem;
padding-block: 0.75rem; padding-block: 0.75rem;
} }
@ -408,6 +422,24 @@ html:has(.modal[open]) {
gap: 1rem; gap: 1rem;
} }
@media (max-width: 40rem) {
.table__header, .table__cell {
padding-inline: 1rem;
}
.table__header--compact, .table__cell--compact {
font-size: 0.75rem;
}
.table__header--compact:not(:first-child), .table__cell--compact:not(:first-child) {
padding-inline-start: 0.5rem;
}
.table__header--compact:not(:last-child), .table__cell--compact:not(:last-child) {
padding-inline-end: 0.5rem;
}
}
/*@media (prefers-color-scheme: dark) { /*@media (prefers-color-scheme: dark) {
.table__header { .table__header {
background-color: rgb(55, 65, 81); background-color: rgb(55, 65, 81);