54 lines
1.0 KiB
Vue
54 lines
1.0 KiB
Vue
<script setup lang="ts">
|
|
import { useLanguages } from "~/composables/useLanguages";
|
|
|
|
interface Props {
|
|
label?: string;
|
|
modelValue?: string;
|
|
direction?: string;
|
|
}
|
|
|
|
const props = defineProps<Props>();
|
|
|
|
|
|
const model = defineModel<string>({ default: 'en' });
|
|
|
|
const { languages } = useLanguages();
|
|
</script>
|
|
|
|
<template>
|
|
<div class="language-selector">
|
|
<label v-if="props.label" class="language-selector-label" :for="props.direction">
|
|
{{ props.label }}
|
|
</label>
|
|
<select
|
|
class="language-selector-input select"
|
|
v-model="model"
|
|
:id="props.direction"
|
|
>
|
|
<option v-for="lang in languages" :key="lang.code" :value="lang.code">
|
|
{{ lang.name }}
|
|
</option>
|
|
</select>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.language-selector {
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex: 1;
|
|
min-width: 150px;
|
|
}
|
|
|
|
.language-selector-label {
|
|
margin-bottom: 0.25rem;
|
|
font-size: 0.875rem;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.language-selector-input {
|
|
padding: 0.5rem;
|
|
font-size: 0.875rem;
|
|
}
|
|
</style>
|