Zamiana menu na listę posterunków w karcie scenerii

This commit is contained in:
2021-10-08 12:09:01 +02:00
parent 23e07a2987
commit 21e15ef316
3 changed files with 47 additions and 16 deletions
+30 -15
View File
@@ -16,17 +16,19 @@
</a> </a>
</h3> </h3>
<div class="checkpoints"> <div
<select-box class="checkpoints"
v-if="stationInfo && stationInfo.checkpoints" v-if="stationInfo && stationInfo.online && stationInfo.checkpoints"
:itemList=" >
stationInfo.checkpoints.map((cp, i) => ({ <button
id: cp.checkpointName, class="checkpoint_item btn--text"
value: cp.checkpointName, :class="{ current: selectedCheckpoint === cp.checkpointName }"
})) v-for="cp in stationInfo.checkpoints"
" :key="cp.checkpointName"
@selected="selectCheckpoint" @click="selectCheckpoint(cp)"
></select-box> >
{{ cp.checkpointName }}
</button>
</div> </div>
<span class="timetable-item loading" v-if="dataStatus == 0">{{ <span class="timetable-item loading" v-if="dataStatus == 0">{{
@@ -207,8 +209,8 @@ export default defineComponent({
this.selectedCheckpoint = this.stationInfo.checkpoints[0].checkpointName; this.selectedCheckpoint = this.stationInfo.checkpoints[0].checkpointName;
}, },
selectCheckpoint(item: { id: number | string; value: string }) { selectCheckpoint(cp: { checkpointName: string }) {
this.selectedCheckpoint = item.value; this.selectedCheckpoint = cp.checkpointName;
}, },
}, },
@@ -408,8 +410,21 @@ h3 {
display: flex; display: flex;
justify-content: center; justify-content: center;
& > div { flex-wrap: wrap;
border: 1px solid white;
font-size: 1.2em;
> .checkpoint_item {
&.current {
font-weight: bold;
color: $accentCol;
}
&:not(:last-child)::after {
margin: 0 0.5em;
content: "•";
color: white;
}
} }
} }
-1
View File
@@ -334,7 +334,6 @@ export const store = createStore<State>({
statusTimeString: "", statusTimeString: "",
stationTrains: [], stationTrains: [],
scheduledTrains: [], scheduledTrains: [],
checkpoints: null
}); });
return acc; return acc;
+17
View File
@@ -198,4 +198,21 @@ ul {
&--grayed { &--grayed {
color: #ccc; color: #ccc;
} }
}
.btn {
&--text {
background: none;
color: white;
font-size: 1em;
cursor: pointer;
transition: color 0.3s;
&:hover, &:focus {
color: $accentCol;
}
}
} }