Adjust dynamic styles on the departure board component

This commit is contained in:
2026-05-12 20:35:12 +01:00
parent b88f4f3b35
commit 0ef9e5b56f
2 changed files with 175 additions and 25 deletions

View File

@@ -9,6 +9,24 @@
</script> </script>
<table class="departure-board"> <table class="departure-board">
<colgroup>
<col style="width:10%;" />
<!-- ID (Headcode) -->
<col style="width:17%;" />
<!-- ORIG (Origin) -->
<col style="width:17%;" />
<!-- DEST (Destination) -->
<col style="width:9%;" />
<!-- PLT (Platform) -->
<col style="width: 12%;" />
<!-- STA -->
<col style="width: 12%;" />
<!-- ETA/ATA -->
<col style="width: 12%;" />
<!-- STD -->
<col style="width: 11%;" />
<!-- ETD/ATD -->
</colgroup>
<thead> <thead>
<tr> <tr>
<th colspan="4" aria-hidden="true"></th> <th colspan="4" aria-hidden="true"></th>
@@ -29,10 +47,19 @@
{#each services as service (getRowKey(service))} {#each services as service (getRowKey(service))}
<tbody> <tbody>
<tr class="service-row" class:serviceCancelled={service.c} class:servicePass={service.wtp} class:serviceNonPassenger={!service.ip}> <tr
class="service-row"
class:serviceCancelled={service.c}
class:servicePass={service.wtp}
class:serviceNonPassenger={!service.ip}
>
<td class="id-cell">{service.h}</td> <td class="id-cell">{service.h}</td>
<td class="orig-cell"><abbr title={service.og.n.toLocaleUpperCase()}>{service.og.t}</abbr></td> <td class="orig-cell"
<td class="dest-cell"><abbr title={service.dt.n.toLocaleUpperCase()}>{service.dt.t}</abbr></td> ><abbr title={service.og.n.toLocaleUpperCase()}>{service.og.t}</abbr></td
>
<td class="dest-cell"
><abbr title={service.dt.n.toLocaleUpperCase()}>{service.dt.t}</abbr></td
>
<td class="plt-cell" class:platSup={service.ps} class:platChange={service.pc} <td class="plt-cell" class:platSup={service.ps} class:platChange={service.pc}
>{service.p || '-'}</td >{service.p || '-'}</td
> >
@@ -95,9 +122,16 @@
{/if} {/if}
</tr> </tr>
{#if service.o}
<tr class="toc-coach-row">
<td colspan="8">
{service.o}
</td>
</tr>
{/if}
{#if service.c && service.cr?.r} {#if service.c && service.cr?.r}
<tr class="cancel-row"> <tr class="cancel-row">
<td colspan="9"> <td colspan="8">
{service.cr.r} {service.cr.r}
{#if service.cr.l} {#if service.cr.l}
{service.cr.n ? 'near' : 'at'} {service.cr.n ? 'near' : 'at'}
@@ -126,12 +160,14 @@
width: 100%; width: 100%;
margin: 5px auto; margin: 5px auto;
border-collapse: collapse; border-collapse: collapse;
table-layout: fixed;
} }
.departure-board td { .departure-board td {
font-family: 'Inconsolata Variable', monospace; font-family: 'Inconsolata Variable', monospace;
font-size: clamp(1rem, 0.475rem + 2.8vw, 1.35rem); font-size: clamp(1rem, 0.475rem + 2.8vw, 1.35rem);
font-variant-ligatures: additional-ligatures; font-variant-ligatures: additional-ligatures;
overflow: hidden;
} }
thead, thead,
@@ -147,11 +183,15 @@
background: var(--color-bg-dark); background: var(--color-bg-dark);
} }
abbr { abbr {
text-decoration: none; text-decoration: none;
border-bottom: none; border-bottom: none;
cursor:help; cursor: help;
} }
tbody tr:first-child td {
border-top: 5px solid transparent;
}
/* Row Logic */ /* Row Logic */
.serviceCancelled { .serviceCancelled {
@@ -163,22 +203,22 @@
font-weight: 200; font-weight: 200;
} }
.serviceNonPassenger td { .serviceNonPassenger td {
opacity: 0.5; opacity: 0.5;
font-weight: 200; font-weight: 290;
font-style: italic; font-style: italic;
} }
/* Special Row Styles */ /* Special Row Styles */
.cancel-row td, .cancel-row td,
.delay-row td { .delay-row td {
font-size: 0.88rem; font-size: 0.88rem;
padding-bottom: 8px; text-align: left;
} }
.cancel-row td[colspan], .cancel-row td[colspan],
.delay-row td[colspan] { .delay-row td[colspan] {
padding-left: 0.75ch; padding-left: 0ch;
} }
.cancel-row td { .cancel-row td {
@@ -190,18 +230,64 @@
color: var(--delay-orange); color: var(--delay-orange);
font-style: italic; font-style: italic;
} }
@media (min-width: 375px) {
.cancel-row td,
.delay-row td {
font-size: 1.08rem;
}
}
@media (min-width: 420px) {
.cancel-row td,
.delay-row td {
font-size: 1.12rem;
}
}
@media (min-width: 550px) {
.cancel-row td,
.delay-row td {
font-size: 1.18rem;
}
}
@media (min-width: 620px) {
.cancel-row td,
.delay-row td {
font-size: 1.20rem;
}
}
.toc-coach-row td {
font-family: 'URW Gothic', sans-serif;
font-size: 0.7rem;
padding: 0;
color: rgb(187, 187, 255);
}
@media(min-width: 400px) {
.toc-coach-row td {
font-size: 0.8rem;
}
}
@media(min-width: 550px) {
.toc-coach-row td {
font-size: 0.85rem;
}
}
/* Column Specifics */ /* Column Specifics */
.id-cell { .id-cell {
text-align: center; text-align: left;
font-weight: 400; font-weight: 400;
font-stretch: 80%; font-stretch: 85%;
filter: brightness(0.75); filter: brightness(0.75);
} }
@media (min-width: 400px) {
.id-cell {
font-stretch: 90%;
}
}
.orig-cell, .orig-cell,
.dest-cell { .dest-cell {
font-stretch: 90%; font-stretch: 80%;
font-weight: 400; font-weight: 400;
} }
.orig-cell { .orig-cell {
text-align: left; text-align: left;
@@ -211,10 +297,53 @@
text-align: right; text-align: right;
color: var(--location-yellow); color: var(--location-yellow);
} }
@media (min-width: 350px) {
.orig-cell,
.dest-cell {
font-stretch: 85%;
}
@media (min-width: 400px) {
.orig-cell,
.dest-cell {
font-stretch: 90%;
}
}
@media (min-width: 490px) {
.orig-cell,
.dest-cell {
font-stretch: 95%;
}
}
@media (min-width: 520px) {
.orig-cell,
.dest-cell {
font-stretch: 100%;
}
.orig-cell {
text-align: right;
padding-right: 7px;
}
.dest-cell {
text-align: left;
padding-left: 7px;
}
}
@media (min-width: 600px) {
.orig-cell,
.dest-cell {
letter-spacing: 0.05ch;
}
}
}
.plt-cell { .plt-cell {
text-align: center; text-align: center;
font-weight: 405; font-weight: 410;
font-stretch: 70%; font-stretch: 100%;
}
@media (min-width: 525px) {
.plt-cell {
font-stretch: 110%;
}
} }
.plt-cell.platSup { .plt-cell.platSup {
font-weight: 200; font-weight: 200;
@@ -228,6 +357,7 @@
} }
.pass-cell { .pass-cell {
text-align: center; text-align: center;
font-stretch: 100%;
} }
/* Colour orig and dest values when cancelled */ /* Colour orig and dest values when cancelled */
.service-row.serviceCancelled .orig-cell, .service-row.serviceCancelled .orig-cell,
@@ -237,7 +367,27 @@
.time-cell { .time-cell {
text-align: center; text-align: center;
font-stretch: 70%; font-stretch: 72%;
}
@media (min-width: 350px) {
.time-cell {
font-stretch: 77%;
}
}
@media (min-width: 400px) {
.time-cell {
font-stretch: 82%;
}
}
@media (min-width: 525px) {
.time-cell {
font-stretch: 90%;
}
}
@media (min-width: 600px) {
.time-cell {
font-stretch: 100%;
}
} }
/* RT Logic */ /* RT Logic */

View File

@@ -147,7 +147,7 @@
<h1 class="viewport-guard-title">Narrow Gauge Detected</h1> <h1 class="viewport-guard-title">Narrow Gauge Detected</h1>
<p> <p>
Just as trains need the right track width, our data needs a bit more room to stay on the rails. Just as trains need the right track width, our data needs a bit more room to stay on the rails.
Please expand your view to at least 300px to view the app. Please expand your view to at least 320px to view the app.
</p> </p>
</div> </div>
@@ -319,7 +319,7 @@
display: none; display: none;
} }
@media (max-width: 299px) { @media (max-width: 319px) {
.viewport-guard { .viewport-guard {
display: block; display: block;
position: fixed; position: fixed;