mirror of
https://github.com/Spythere/pojazdownik.git
synced 2026-05-04 20:18:12 +00:00
Animacje, dostępność
This commit is contained in:
+3
-3
@@ -146,11 +146,11 @@ main {
|
|||||||
gap: 1em 3em;
|
gap: 1em 3em;
|
||||||
|
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
max-width: 1200px;
|
max-width: 1300px;
|
||||||
min-height: 75vh;
|
min-height: 75vh;
|
||||||
|
|
||||||
grid-template-columns: 1fr 3fr;
|
grid-template-columns: 1fr 2fr;
|
||||||
grid-template-rows: 250px auto;
|
grid-template-rows: 350px auto;
|
||||||
|
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="inputs-section">
|
<section class="inputs-section">
|
||||||
<div class="input inputs_loco">
|
|
||||||
<div class="input_container">
|
<div class="input_container">
|
||||||
<h2 class="input_header">WYBIERZ POJAZDY / WAGONY</h2>
|
<h2 class="input_header">WYBIERZ POJAZDY / WAGONY</h2>
|
||||||
|
|
||||||
<div class="input_list type">
|
<div class="input_list type">
|
||||||
|
<label for="locomotives-list">Pojazdy trakcyjne</label>
|
||||||
<select
|
<select
|
||||||
id="locomotives-list"
|
id="locomotives-list"
|
||||||
v-model="store.chosenLoco"
|
v-model="store.chosenLoco"
|
||||||
@@ -21,6 +21,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input_list type">
|
<div class="input_list type">
|
||||||
|
<label for="locomotives-list">Wagony</label>
|
||||||
|
|
||||||
<select
|
<select
|
||||||
id="carwagons-list"
|
id="carwagons-list"
|
||||||
v-model="store.chosenCar"
|
v-model="store.chosenCar"
|
||||||
@@ -38,6 +40,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input_list cargo">
|
<div class="input_list cargo">
|
||||||
|
<label for="cargo-select">Ładunek (tylko wybrane towarowe)</label>
|
||||||
<select
|
<select
|
||||||
id="cargo-select"
|
id="cargo-select"
|
||||||
:disabled="
|
:disabled="
|
||||||
@@ -80,7 +83,6 @@
|
|||||||
<ready-stock-list />
|
<ready-stock-list />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -176,6 +178,7 @@ export default defineComponent({
|
|||||||
if (!vehicle) return;
|
if (!vehicle) return;
|
||||||
|
|
||||||
const stockObj: IStock = {
|
const stockObj: IStock = {
|
||||||
|
id: `${Date.now()}`,
|
||||||
useType: isLocomotive(vehicle) ? vehicle.power : vehicle.useType,
|
useType: isLocomotive(vehicle) ? vehicle.power : vehicle.useType,
|
||||||
type: vehicle.type,
|
type: vehicle.type,
|
||||||
length: vehicle.length,
|
length: vehicle.length,
|
||||||
@@ -198,6 +201,7 @@ export default defineComponent({
|
|||||||
if (!vehicle) return;
|
if (!vehicle) return;
|
||||||
|
|
||||||
const stockObj: IStock = {
|
const stockObj: IStock = {
|
||||||
|
id: `${Date.now()}`,
|
||||||
useType: isLocomotive(vehicle) ? vehicle.power : vehicle.useType,
|
useType: isLocomotive(vehicle) ? vehicle.power : vehicle.useType,
|
||||||
type: vehicle.type,
|
type: vehicle.type,
|
||||||
length: vehicle.length,
|
length: vehicle.length,
|
||||||
@@ -263,7 +267,14 @@ export default defineComponent({
|
|||||||
|
|
||||||
&_list {
|
&_list {
|
||||||
margin: 0.5em 0;
|
margin: 0.5em 0;
|
||||||
display: flex;
|
|
||||||
|
label {
|
||||||
|
display: block;
|
||||||
|
|
||||||
|
font-weight: bold;
|
||||||
|
color: $accentColor;
|
||||||
|
margin-bottom: 0.3em;
|
||||||
|
}
|
||||||
|
|
||||||
select:focus {
|
select:focus {
|
||||||
border-color: $accentColor;
|
border-color: $accentColor;
|
||||||
@@ -304,23 +315,13 @@ export default defineComponent({
|
|||||||
|
|
||||||
@media screen and (max-width: $breakpointMd) {
|
@media screen and (max-width: $breakpointMd) {
|
||||||
.inputs-section {
|
.inputs-section {
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input {
|
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
margin: 1em 0;
|
|
||||||
|
|
||||||
_header {
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
&_container > * {
|
.input_actions {
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
1
|
1
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<input type="number" name="stock-count" id="stock-count" v-model="chosenStockVehicle.count" />
|
<input type="number" min="1" name="stock-count" id="stock-count" v-model="chosenStockVehicle.count" />
|
||||||
|
|
||||||
<button class="action-btn" @click="addStock(store.chosenStockListIndex)">
|
<button class="action-btn" @click="addStock(store.chosenStockListIndex)">
|
||||||
<img :src="icons.add" alt="add vehicle count" />
|
<img :src="icons.add" alt="add vehicle count" />
|
||||||
@@ -94,18 +94,17 @@
|
|||||||
<div class="stock-info">Lista pojazdów jest pusta!</div>
|
<div class="stock-info">Lista pojazdów jest pusta!</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<transition-group name="stock-list-anim">
|
||||||
<li
|
<li
|
||||||
v-for="(stock, i) in store.stockList"
|
v-for="(stock, i) in store.stockList"
|
||||||
:key="stock.type + i"
|
:key="stock.id"
|
||||||
:class="{ loco: stock.isLoco }"
|
:class="{ loco: stock.isLoco }"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
@click="onListItemClick(i)"
|
@click="onListItemClick(i)"
|
||||||
|
|
||||||
@keydown.enter="onListItemClick(i)"
|
@keydown.enter="onListItemClick(i)"
|
||||||
@keydown.w="moveUpStock(i)"
|
@keydown.w="moveUpStock(i)"
|
||||||
@keydown.s="moveDownStock(i)"
|
@keydown.s="moveDownStock(i)"
|
||||||
@keydown.backspace="removeStock(i)"
|
@keydown.backspace="removeStock(i)"
|
||||||
|
|
||||||
ref="itemRefs"
|
ref="itemRefs"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@@ -132,6 +131,7 @@
|
|||||||
<span class="stock-info__count"> x{{ stock.count }} </span>
|
<span class="stock-info__count"> x{{ stock.count }} </span>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
</transition-group>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
@@ -476,14 +476,15 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
|
||||||
|
height: 50vh;
|
||||||
|
min-height: 500px;
|
||||||
margin-top: 1em;
|
margin-top: 1em;
|
||||||
|
|
||||||
max-height: 500px;
|
|
||||||
overflow: auto;
|
|
||||||
|
|
||||||
padding: 0.25em;
|
padding: 0.25em;
|
||||||
|
|
||||||
border: 2px solid gray;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ul > li {
|
ul > li {
|
||||||
@@ -491,16 +492,14 @@ ul > li {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
|
margin: 0.25em 0;
|
||||||
|
|
||||||
outline: none;
|
outline: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
&:focus-visible {
|
&:focus-visible {
|
||||||
outline: 1px solid white;
|
outline: 1px solid white;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover .item-content {
|
|
||||||
color: $accentColor;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
li > .stock-info {
|
li > .stock-info {
|
||||||
@@ -508,7 +507,6 @@ li > .stock-info {
|
|||||||
|
|
||||||
color: white;
|
color: white;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
margin: 0.25em 0;
|
|
||||||
|
|
||||||
transition: color 100ms;
|
transition: color 100ms;
|
||||||
|
|
||||||
@@ -552,7 +550,31 @@ li > .stock-info {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.stock-list-anim {
|
||||||
|
&-move, /* apply transition to moving elements */
|
||||||
|
&-enter-active,
|
||||||
|
&-leave-active {
|
||||||
|
transition: all 250ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-enter-from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(-25px);
|
||||||
|
}
|
||||||
|
|
||||||
|
&-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-leave-active {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (max-width: $breakpointMd) {
|
@media screen and (max-width: $breakpointMd) {
|
||||||
|
ul {
|
||||||
|
min-height: auto;
|
||||||
|
}
|
||||||
li > .stock-info {
|
li > .stock-info {
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@
|
|||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
|
|
||||||
import carUsage from '../data/carUsage.json';
|
import carUsage from '../data/carUsage.json';
|
||||||
import { ICarWagon, ILocomotive, ICargo } from '../types';
|
import { ICarWagon, ILocomotive, ICargo, IStock } from '../types';
|
||||||
|
|
||||||
import randomizeIcon from '../assets/randomize-icon.svg';
|
import randomizeIcon from '../assets/randomize-icon.svg';
|
||||||
import { useStore } from '../store';
|
import { useStore } from '../store';
|
||||||
@@ -321,7 +321,8 @@ export default defineComponent({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const stockObj = {
|
const stockObj: IStock = {
|
||||||
|
id: `${Date.now()+this.store.stockList.length}`,
|
||||||
type: loco.type,
|
type: loco.type,
|
||||||
length: loco.length,
|
length: loco.length,
|
||||||
mass: loco.mass,
|
mass: loco.mass,
|
||||||
@@ -348,7 +349,8 @@ export default defineComponent({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const stockObj = {
|
const stockObj: IStock = {
|
||||||
|
id: `${Date.now()+this.store.stockList.length}`,
|
||||||
type: car.type,
|
type: car.type,
|
||||||
length: car.length,
|
length: car.length,
|
||||||
mass: car.mass,
|
mass: car.mass,
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, inject } from 'vue';
|
import { defineComponent, inject } from 'vue';
|
||||||
import { IStore, ILocomotive, ICarWagon, Vehicle } from '../types';
|
import { IStore, ILocomotive, ICarWagon, Vehicle, IStock } from '../types';
|
||||||
|
|
||||||
import iconEIC from '../assets/EIC.png';
|
import iconEIC from '../assets/EIC.png';
|
||||||
import iconIC from '../assets/IC.svg';
|
import iconIC from '../assets/IC.svg';
|
||||||
@@ -138,7 +138,8 @@ export default defineComponent({
|
|||||||
addVehicle(vehicle: Vehicle | null) {
|
addVehicle(vehicle: Vehicle | null) {
|
||||||
if (!vehicle) return;
|
if (!vehicle) return;
|
||||||
|
|
||||||
const stockObj = {
|
const stockObj: IStock = {
|
||||||
|
id: `${Date.now() + this.store.stockList.length}`,
|
||||||
type: vehicle.type,
|
type: vehicle.type,
|
||||||
length: vehicle.length,
|
length: vehicle.length,
|
||||||
mass: vehicle.mass,
|
mass: vehicle.mass,
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ export interface ICargo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IStock {
|
export interface IStock {
|
||||||
|
id: string;
|
||||||
useType: string;
|
useType: string;
|
||||||
type: string;
|
type: string;
|
||||||
length: number;
|
length: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user