From 0ccd4f64603e146d5821dfc69ecb77568b6c99b7 Mon Sep 17 00:00:00 2001 From: Spythere Date: Sun, 31 Jul 2022 23:35:07 +0200 Subject: [PATCH] =?UTF-8?q?Animacje,=20dost=C4=99pno=C5=9B=C4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 6 +- src/components/InputsSection.vue | 173 +++++++++++++++--------------- src/components/ListSection.vue | 114 ++++++++++++-------- src/components/RandomizerCard.vue | 8 +- src/components/ReadyStockList.vue | 7 +- src/types.ts | 1 + 6 files changed, 168 insertions(+), 141 deletions(-) diff --git a/src/App.vue b/src/App.vue index 0384b58..9721da6 100644 --- a/src/App.vue +++ b/src/App.vue @@ -146,11 +146,11 @@ main { gap: 1em 3em; width: 100vw; - max-width: 1200px; + max-width: 1300px; min-height: 75vh; - grid-template-columns: 1fr 3fr; - grid-template-rows: 250px auto; + grid-template-columns: 1fr 2fr; + grid-template-rows: 350px auto; padding: 0.5em; } diff --git a/src/components/InputsSection.vue b/src/components/InputsSection.vue index 1278975..a95f7d5 100644 --- a/src/components/InputsSection.vue +++ b/src/components/InputsSection.vue @@ -1,84 +1,86 @@ @@ -476,14 +476,15 @@ export default defineComponent({ } ul { + position: relative; + + overflow-y: auto; + overflow-x: hidden; + + height: 50vh; + min-height: 500px; margin-top: 1em; - - max-height: 500px; - overflow: auto; - padding: 0.25em; - - border: 2px solid gray; } ul > li { @@ -491,16 +492,14 @@ ul > li { align-items: center; justify-content: space-between; + margin: 0.25em 0; + outline: none; cursor: pointer; &:focus-visible { outline: 1px solid white; } - - &:hover .item-content { - color: $accentColor; - } } li > .stock-info { @@ -508,7 +507,6 @@ li > .stock-info { color: white; font-weight: 700; - margin: 0.25em 0; 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) { + ul { + min-height: auto; + } li > .stock-info { font-size: 0.9em; } diff --git a/src/components/RandomizerCard.vue b/src/components/RandomizerCard.vue index b1770e4..ea3c82b 100644 --- a/src/components/RandomizerCard.vue +++ b/src/components/RandomizerCard.vue @@ -98,7 +98,7 @@ import { defineComponent } from 'vue'; 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 { useStore } from '../store'; @@ -321,7 +321,8 @@ export default defineComponent({ return; } - const stockObj = { + const stockObj: IStock = { + id: `${Date.now()+this.store.stockList.length}`, type: loco.type, length: loco.length, mass: loco.mass, @@ -348,7 +349,8 @@ export default defineComponent({ return; } - const stockObj = { + const stockObj: IStock = { + id: `${Date.now()+this.store.stockList.length}`, type: car.type, length: car.length, mass: car.mass, diff --git a/src/components/ReadyStockList.vue b/src/components/ReadyStockList.vue index 517fd3f..57eb481 100644 --- a/src/components/ReadyStockList.vue +++ b/src/components/ReadyStockList.vue @@ -39,7 +39,7 @@