Prettier formatting

This commit is contained in:
Fred Boniface
2023-07-07 11:27:28 +01:00
parent 039b57efe7
commit 7dc24646b9
49 changed files with 2796 additions and 2419 deletions

View File

@@ -1,114 +1,133 @@
<script>
import { fly } from "svelte/transition";
import { fly } from 'svelte/transition';
export let service = ""
export let service = '';
let isExpanded = false;
async function expand() {
isExpanded = !isExpanded
}
let isExpanded = false;
async function expand() {
isExpanded = !isExpanded;
}
</script>
<div class="container">
<div class="container-header" on:click={expand} on:keypress={expand}>
<span class="header">{service.operator || "GW"}: {service.stops[0]['publicDeparture'] || service.stops[0]['wttDeparture']} {service.stops[0]['tiploc']} to {service.stops[service['stops'].length -1]['tiploc']}</span>
<span id="container-arrow" class:isExpanded>V</span>
</div>
{#if isExpanded}
<div class="container-detail" in:fly={{ y: -20, duration: 200}}>
{#if service.pis}
<p class="pis">PIS: {service.pis}</p>
<div class="container-header" on:click={expand} on:keypress={expand}>
<span class="header"
>{service.operator || 'GW'}: {service.stops[0]['publicDeparture'] ||
service.stops[0]['wttDeparture']}
{service.stops[0]['tiploc']} to {service.stops[
service['stops'].length - 1
]['tiploc']}</span
>
<span id="container-arrow" class:isExpanded>V</span>
</div>
{#if isExpanded}
<div class="container-detail" in:fly={{ y: -20, duration: 200 }}>
{#if service.pis}
<p class="pis">PIS: {service.pis}</p>
{/if}
<p class="svc-detail">
Planned Type: {parseInt(service.planSpeed) || 68}mph {service.powerType ||
'Bus'}
</p>
<p class="svc-detail">
Days Run: {service.daysRun.join(', ').toUpperCase()}
</p>
<p class="svc-detail validity">
Valid From: {new Date(service.scheduleStartDate).toLocaleDateString(
'en-GB',
{
timeZone: 'UTC'
}
)} - {new Date(service.scheduleEndDate).toLocaleDateString('en-GB', {
timeZone: 'UTC'
})}
</p>
<table>
<tr>
<th>Location</th>
<th>Sch Arr.</th>
<th>Sch Dep.</th>
</tr>
{#if service.stops[0]['publicDeparture']}
{#each service.stops as stop}
{#if stop.publicArrival || stop.publicDeparture}
<tr>
<td>{stop.tiploc}</td>
<td>{stop.publicArrival || '-'}</td>
<td>{stop.publicDeparture || '-'}</td>
</tr>
{/if}
<p class="svc-detail">Planned Type: {parseInt(service.planSpeed) || 68 }mph {service.powerType || "Bus" }</p>
<p class="svc-detail">Days Run: {service.daysRun.join(", ").toUpperCase()}</p>
<p class="svc-detail validity">Valid From: {new Date(service.scheduleStartDate).toLocaleDateString('en-GB', {timeZone: 'UTC'})} - {new Date(service.scheduleEndDate).toLocaleDateString('en-GB', {timeZone: 'UTC'})}</p>
<table>
<tr>
<th>Location</th>
<th>Sch Arr.</th>
<th>Sch Dep.</th>
</tr>
{#if service.stops[0]['publicDeparture']}
{#each service.stops as stop}
{#if stop.publicArrival || stop.publicDeparture}
<tr>
<td>{stop.tiploc}</td>
<td>{stop.publicArrival || '-'}</td>
<td>{stop.publicDeparture || '-'}</td>
</tr>
{/if}
{/each}
{:else}
{#each service.stops as stop}
<tr>
<td>{stop.tiploc}</td>
<td>{stop.wttArrival || '-'}</td>
<td>{stop.wttDeparture || '-'}</td>
</tr>
{/each}
{/if}
</table>
</div>
{/if}
{/each}
{:else}
{#each service.stops as stop}
<tr>
<td>{stop.tiploc}</td>
<td>{stop.wttArrival || '-'}</td>
<td>{stop.wttDeparture || '-'}</td>
</tr>
{/each}
{/if}
</table>
</div>
{/if}
</div>
<style>
.container {
position: relative;
margin: auto;
margin-bottom: 20px;
width: 95%;
max-width: 600px;
height: auto;
background-color: var(--overlay-color);
border-radius: 10px;
overflow: hidden;
transition: height 500ms ease-in-out;
}
.container-header {
text-align: left;
padding-left: 10px;
font-size: 14px;
font-weight: 600;
padding-top: 12px;
padding-bottom: 10px;
}
#container-arrow {
font-family: Arial, Helvetica, sans-serif;
font-weight: 600;
color: white;
margin: 0;
padding: 0;
position: absolute;
right: 16px;
top: 13px;
transition-duration: 300ms;
z-index: 2;
}
.isExpanded {
transform: rotate(180deg);
}
.pis {
font-size: 18px;
font-weight: 600;
color: azure;
margin-top: 10px;
margin-bottom: 5px;
}
.svc-detail {
margin-top: 2px;
margin-bottom: 2px;
color: white;
}
.validity {
font-size: 14px;
}
table {
margin: auto;
padding-top: 10px;
padding-bottom: 10px;
color: white;
}
</style>
.container {
position: relative;
margin: auto;
margin-bottom: 20px;
width: 95%;
max-width: 600px;
height: auto;
background-color: var(--overlay-color);
border-radius: 10px;
overflow: hidden;
transition: height 500ms ease-in-out;
}
.container-header {
text-align: left;
padding-left: 10px;
font-size: 14px;
font-weight: 600;
padding-top: 12px;
padding-bottom: 10px;
}
#container-arrow {
font-family: Arial, Helvetica, sans-serif;
font-weight: 600;
color: white;
margin: 0;
padding: 0;
position: absolute;
right: 16px;
top: 13px;
transition-duration: 300ms;
z-index: 2;
}
.isExpanded {
transform: rotate(180deg);
}
.pis {
font-size: 18px;
font-weight: 600;
color: azure;
margin-top: 10px;
margin-bottom: 5px;
}
.svc-detail {
margin-top: 2px;
margin-bottom: 2px;
color: white;
}
.validity {
font-size: 14px;
}
table {
margin: auto;
padding-top: 10px;
padding-bottom: 10px;
color: white;
}
</style>