gctGenerator/site/.vuepress/components/VersionCards.vue

69 lines
1.2 KiB
Vue
Raw Normal View History

2020-06-29 03:04:31 +09:00
<template>
<div class="wrapper">
2021-06-11 07:48:15 +09:00
<div
v-for="(version, idx) in gameVersions"
v-bind:key="idx"
class="card"
@click="onCardClick(version)"
>
<h3>{{ getLabel(`common.${version.identifier}`) }}</h3>
2020-06-29 03:04:31 +09:00
</div>
</div>
</template>
<script>
// Data
import gameVersions from '../data/gameVersions.json';
import locales from '../i18n/locales.json';
// Util
import { translate } from '../i18n/localeHelper';
2020-06-29 03:04:31 +09:00
export default {
data() {
return {
gameVersions,
};
},
methods: {
onCardClick(v) {
let localePath = '';
Object.keys(locales).forEach((l) => {
if (locales[l].lang === this.$lang) localePath = l.replace(/\/+$/, '');
});
window.location.href = `${localePath}/code-reference/${v.identifier.toLowerCase()}.html`;
},
getLabel(key) {
return translate(key, this.$lang);
2020-06-29 03:04:31 +09:00
},
},
};
</script>
<style scoped>
.wrapper {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
}
.card {
width: 300px;
max-width: 100%;
margin: 5px;
padding: 15px;
background-color: #f3f5f7;
border-left: 0.5rem solid #42b983;
cursor: pointer;
text-align: center;
color: #3eaf7c;
}
.card:hover {
background-color: #e5f0eb;
}
2020-07-01 14:26:48 +09:00
</style>