From 767e0839e048f4ff7b99645ada4955db567a78a9 Mon Sep 17 00:00:00 2001 From: Spythere Date: Fri, 29 Jul 2022 00:28:00 +0200 Subject: [PATCH] =?UTF-8?q?Poprawki=20layoutu=20i=20responsywno=C5=9Bci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 19 ++- src/components/InputsSection.vue | 94 +++++++++---- src/components/ListSection.vue | 44 +++--- src/components/RandomizerCard.vue | 2 +- src/components/ReadyStockList.vue | 1 + src/styles/global.scss | 221 ++++++++++++++++-------------- 6 files changed, 215 insertions(+), 166 deletions(-) diff --git a/src/App.vue b/src/App.vue index 2296484..454ed20 100644 --- a/src/App.vue +++ b/src/App.vue @@ -152,13 +152,14 @@ main { display: grid; gap: 1em 3em; - width: 100%; - max-width: 1200px; + width: 100vw; + max-width: 1300px; grid-template-columns: 1fr 2fr; - grid-template-areas: 'inputs list' 'image list'; + padding: 0.5em; + #inputs-area { grid-area: inputs; } @@ -181,15 +182,19 @@ footer { /* MOBILE VIEWS */ +@media screen and (max-width: 1100px) { + main { + grid-template-columns: 1fr; + grid-template-areas: 'inputs' 'image' 'list'; + justify-items: center; + } +} + @media screen and (max-width: 800px) { #app { font-size: calc(0.75vw + 0.6rem); } - main { - margin-top: 3.5em; - } - header { font-size: 0.85em; diff --git a/src/components/InputsSection.vue b/src/components/InputsSection.vue index 96d7de0..53b5d81 100644 --- a/src/components/InputsSection.vue +++ b/src/components/InputsSection.vue @@ -17,7 +17,7 @@ - +
@@ -33,17 +33,34 @@ {{ car.type }} + +
-
+
@@ -107,13 +124,11 @@ export default defineComponent({ computed: { locoOptions() { - return this.store.locoDataList - .sort((a, b) => (a.type > b.type ? 1 : -1)) - .sort((a) => (a.supportersOnly ? 1 : -1)); + return this.store.locoDataList.sort((a, b) => (a.type > b.type ? 1 : -1)); }, carOptions() { - return this.store.carDataList.sort((a, b) => (a.type > b.type ? 1 : -1)).sort((a) => (a.supportersOnly ? 1 : -1)); + return this.store.carDataList.sort((a, b) => (a.type > b.type ? 1 : -1)); }, }, @@ -134,7 +149,9 @@ export default defineComponent({ }); }, - addVehicle() { + switchVehicles() { + if (this.store.chosenStockListIndex == -1) return; + const vehicle = this.store.chosenVehicle; if (!vehicle) return; @@ -153,28 +170,45 @@ export default defineComponent({ supportersOnly: vehicle.supportersOnly, }; - if (this.store.chosenStockListIndex != -1) { - let currentStock = this.store.stockList[this.store.chosenStockListIndex]; + let currentStock = this.store.stockList[this.store.chosenStockListIndex]; - if (isLocomotive(vehicle) && currentStock && currentStock.type == vehicle.type) { - this.store.stockList[this.store.chosenStockListIndex].count++; - return; - } + // if (isLocomotive(vehicle) && currentStock && currentStock.type == vehicle.type) { + // this.store.stockList[this.store.chosenStockListIndex].count++; + // return; + // } - if ( - !isLocomotive(vehicle) && - currentStock && - currentStock.type == vehicle.type && - currentStock.cargo?.id == this.store.chosenCargo?.id - ) { - this.store.stockList[this.store.chosenStockListIndex].count++; + // if ( + // !isLocomotive(vehicle) && + // currentStock && + // currentStock.type == vehicle.type && + // currentStock.cargo?.id == this.store.chosenCargo?.id + // ) { + // this.store.stockList[this.store.chosenStockListIndex].count++; - return; - } + // return; + // } - this.store.stockList[this.store.chosenStockListIndex] = stockObj; - return; - } + this.store.stockList[this.store.chosenStockListIndex] = stockObj; + }, + + addVehicle() { + const vehicle = this.store.chosenVehicle; + + if (!vehicle) return; + + const stockObj: IStock = { + useType: isLocomotive(vehicle) ? vehicle.power : vehicle.useType, + type: vehicle.type, + length: vehicle.length, + mass: vehicle.mass, + maxSpeed: vehicle.maxSpeed, + isLoco: isLocomotive(vehicle), + cargo: + !isLocomotive(vehicle) && vehicle.loadable && this.store.chosenCargo ? this.store.chosenCargo : undefined, + count: 1, + imgSrc: vehicle.imageSrc, + supportersOnly: vehicle.supportersOnly, + }; const previousStock = this.store.stockList.length > 0 ? this.store.stockList[this.store.stockList.length - 1] : null; diff --git a/src/components/ListSection.vue b/src/components/ListSection.vue index 01aa964..2003c06 100644 --- a/src/components/ListSection.vue +++ b/src/components/ListSection.vue @@ -53,7 +53,7 @@
Ten skład posiada za dużo pojazdów trakcyjnych!
--> -