feat: mission tab first draft

This commit is contained in:
pskfyi 2022-01-07 19:46:33 -08:00 committed by pskfyi
commit eedceccd3d
5 changed files with 152 additions and 16 deletions

View file

@ -0,0 +1,74 @@
<template>
<button
class="relative flex flex-col pt-2 pb-3 px-3 border rounded-lg overflow-hidden"
:class="[colorClasses, clickable ? 'cursor-pointer' : 'cursor-default']"
:disable="!clickable"
>
<progress
v-if="!clickable"
class="absolute top-0 left-0 right-0 h-1 w-full"
:max="max"
:value="value"
/>
<span class="absolute top-3 right-3 font-semibold text-sm">
{{ value }} / {{ max }}
<span class="fas fa-hourglass-half" />
</span>
<span
class="w-full text-left lg:text-center text-lg md:text-xl font-semibold"
v-text="label"
/>
<p class="w-full text-left" v-text="description" />
</button>
</template>
<script>
export default {
props: {
label: { type: String, required: true },
description: { type: String, default: null },
max: { type: Number, required: true },
value: { type: Number, required: true },
unit: { type: String, default: null },
},
computed: {
clickable() {
return this.value >= this.max
},
colorClasses() {
const { lightColor, darkColor } = this.$store.getters.activeTab
return this.clickable
? `bg-${darkColor} text-${lightColor}`
: `bg-${lightColor} text-${darkColor}`
},
},
}
</script>
<style scoped>
button {
border-color: currentColor;
}
/* progress background for all browsers */
progress::-webkit-progress-bar {
background-color: rgba(0, 0, 0, 0.1);
width: 100%;
}
progress {
background-color: rgba(0, 0, 0, 0.1);
}
/* progress value for all browsers */
progress::-webkit-progress-value {
background-color: currentColor;
}
progress::-moz-progress-bar {
background-color: currentColor;
}
progress {
color: currentColor;
}
</style>

View file

@ -1,7 +1,7 @@
<template>
<div class="tab-content grid flex-col">
<div
v-for="(process, index) in $store.state.incremental.processes"
v-for="(process, index) in $store.state.processes"
:key="index"
class="flex flex-col mb-4 p-4 rounded border"
:class="`border-${$store.getters.activeTab.darkColor}`"

View file

@ -0,0 +1,33 @@
<template>
<div class="tab-content grid md:overflow-hidden">
<template v-for="(mission, index) in $store.state.missions">
<progress-button
:key="index"
:label="mission.name"
:description="mission.description"
:max="100"
:value="50 * (2 - index)"
/>
</template>
</div>
</template>
<style scoped>
.tab-content {
--columns: 1;
grid-template-columns: repeat(var(--columns), minmax(0, 1fr));
grid-gap: 1rem;
}
/* md */
@media (min-width: 768px) {
.tab-content {
--columns: 2;
}
}
/* 2xl */
@media (min-width: 1536px) {
.tab-content {
--columns: 3;
}
}
</style>