This repository has been archived on 2024-03-13. You can view files and clone it, but cannot push or open issues or pull requests.
timekeeper/components/GameTab.vue

48 lines
1013 B
Vue
Raw Normal View History

2022-01-07 01:17:26 +00:00
<template>
2022-01-10 03:28:09 +00:00
<nuxt-link
class="tab flex-grow text-center text-2xl font-semibold py-1 cursor-pointer rounded-tl-lg rounded-tr-lg"
:class="[colorClasses, index < 5 && 'mr-px', active && 'active']"
2022-01-10 03:28:09 +00:00
:to="tabData.route"
2022-01-07 01:17:26 +00:00
>
<template v-if="!tabData.locked">
<span :class="tabData.label" />
</template>
<template v-if="tabData.locked">
<span class="fas fa-lock" />
</template>
2022-01-10 03:28:09 +00:00
</nuxt-link>
2022-01-07 01:17:26 +00:00
</template>
<script>
export default {
props: {
index: {
type: Number,
required: true,
},
tabData: {
type: Object,
required: true,
},
},
computed: {
active() {
2022-01-10 03:28:09 +00:00
return this.$route.path === this.tabData.route
2022-01-07 01:17:26 +00:00
},
colorClasses() {
2022-01-10 03:28:09 +00:00
const { lightColor, darkColor } = this.tabData
2022-01-07 01:17:26 +00:00
return this.active
2022-01-10 03:28:09 +00:00
? `bg-${lightColor} text-${darkColor}`
: `bg-${darkColor} text-${lightColor}`
2022-01-07 01:17:26 +00:00
},
},
}
</script>
<style scoped>
.active {
box-shadow: 3px 28px 9px -5px #000, 3px -1px 9px -4px #000;
}
</style>