miniaturki: style

This commit is contained in:
2023-02-06 18:09:29 +01:00
parent 190f026b91
commit 9893353daf
2 changed files with 34 additions and 21 deletions
+1 -1
View File
@@ -86,7 +86,6 @@ export default defineComponent({
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding: 1em;
} }
/* APP */ /* APP */
@@ -95,6 +94,7 @@ export default defineComponent({
color: $textColor; color: $textColor;
font-size: 1em; font-size: 1em;
padding: 1em;
display: flex; display: flex;
justify-content: center; justify-content: center;
+33 -20
View File
@@ -91,22 +91,6 @@
</span> </span>
</div> </div>
<div class="stock_thumbnails" ref="thumbnails">
<div v-for="(stock, stockIndex) in store.stockList" :data-selected="store.chosenStockListIndex == stockIndex">
<img
v-for="i in stock.count"
@click="onListItemClick(stockIndex)"
:key="stock.id"
:src="`https://rj.td2.info.pl/dist/img/thumbnails/${stock.type}.png`"
:alt="stock.type"
:title="stock.type"
@error="stockImageError($event, stock)"
/>
<!-- <b>{{ stock.type }}</b> -->
</div>
</div>
<div class="stock_warnings"> <div class="stock_warnings">
<div class="warning" v-if="locoNotSuitable"> <div class="warning" v-if="locoNotSuitable">
Lokomotywy EP07 i EP08 przeznaczone jedynie do ruchu pasażerskiego! Lokomotywy EP07 i EP08 przeznaczone jedynie do ruchu pasażerskiego!
@@ -133,6 +117,21 @@
<div class="warning" v-if="tooManyLocomotives">Ten skład posiada za dużo pojazdów trakcyjnych!</div> <div class="warning" v-if="tooManyLocomotives">Ten skład posiada za dużo pojazdów trakcyjnych!</div>
</div> </div>
<div class="stock_thumbnails" ref="thumbnails">
<div v-for="(stock, stockIndex) in store.stockList" :data-selected="store.chosenStockListIndex == stockIndex">
<span v-for="i in stock.count" @click="onListItemClick(stockIndex)" :key="stock.id">
<b>{{ stock.type }}</b>
<img
:src="`https://rj.td2.info.pl/dist/img/thumbnails/${stock.type}.png`"
:alt="stock.type"
:title="stock.type"
@error="stockImageError($event, stock)"
/>
</span>
</div>
</div>
<!-- Stock list --> <!-- Stock list -->
<ul ref="list"> <ul ref="list">
<li v-if="store.stockList.length == 0" class="list-empty"> <li v-if="store.stockList.length == 0" class="list-empty">
@@ -214,6 +213,8 @@ export default defineComponent({
watch: { watch: {
'store.chosenStockListIndex': { 'store.chosenStockListIndex': {
handler(id: number) { handler(id: number) {
if (id < 0) return;
(this.$refs['thumbnails'] as HTMLElement) (this.$refs['thumbnails'] as HTMLElement)
.querySelector(`div:nth-child(${id + 1})`) .querySelector(`div:nth-child(${id + 1})`)
?.scrollIntoView({ block: 'nearest', inline: 'start', behavior: 'smooth' }); ?.scrollIntoView({ block: 'nearest', inline: 'start', behavior: 'smooth' });
@@ -488,7 +489,7 @@ ul {
overflow: auto; overflow: auto;
height: 70vh; height: 500px;
} }
ul > li { ul > li {
@@ -530,6 +531,10 @@ li > .stock-info {
} }
} }
.stock_warnings {
margin: 0.5em 0;
}
.stock-info { .stock-info {
&__no, &__no,
&__type { &__type {
@@ -596,12 +601,20 @@ li > .stock-info {
&[data-selected='true'] { &[data-selected='true'] {
background-color: rebeccapurple; background-color: rebeccapurple;
} }
span {
display: flex;
flex-direction: column;
gap: 0.5em;
padding: 0.5em 0;
text-align: center;
font-size: 0.85em;
}
} }
img { img {
margin: 0.5em 0;
// max-width: 150px;
max-height: 60px; max-height: 60px;
} }
} }