-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c428cad
commit 2644367
Showing
7 changed files
with
75 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<script lang="ts" setup> | ||
import { BccButton, BccInput } from "@bcc-code/design-library-vue"; | ||
const form = defineModel<BMMSingleForm>({ required: true }); | ||
const language = computedProperty(form, "language"); | ||
const originalTitle = computedProperty(form, "originalTitle"); | ||
defineEmits<{ | ||
submit: []; | ||
}>(); | ||
</script> | ||
<template> | ||
<form class="flex flex-col gap-4 p-4" @submit.prevent="$emit('submit')"> | ||
<h3 class="text-lg font-bold">BMM Upload</h3> | ||
<BccInput | ||
v-model="originalTitle" | ||
:label="$t('originalTitle')" | ||
required | ||
/> | ||
<LanguageSelector v-model="language" :languages="bmmLanguages" /> | ||
<BccButton type="submit">Next</BccButton> | ||
</form> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<script lang="ts" setup> | ||
import { BccSelect } from "@bcc-code/design-library-vue"; | ||
defineProps<{ | ||
languages: readonly string[]; | ||
}>(); | ||
const value = defineModel<string>(); | ||
const languageDisplay = (l: string) => { | ||
if (typeof Intl.DisplayNames !== "undefined") { | ||
const dn = new Intl.DisplayNames(["en"], { type: "language" }); | ||
return dn.of(l); | ||
} | ||
}; | ||
</script> | ||
|
||
<template> | ||
<BccSelect v-model="value" :label="$t('language')"> | ||
<option disabled value="">{{ $t("selectAnOption") }}</option> | ||
<option v-for="l in languages" :value="l"> | ||
{{ languageDisplay(l) }} | ||
</option> | ||
</BccSelect> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"dragAndDropFileHere": "Drag and drop file here or click to browse", | ||
"originalTitle": "Original title", | ||
"language": "Language" | ||
"language": "Language", | ||
"selectAnOption": "Select an option..." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export type BMMSingleForm = { | ||
originalTitle: string; | ||
language?: (typeof bmmLanguages)[number]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export default <T extends {}>(ref: Ref<T | undefined>, property: keyof T) => { | ||
return computed({ | ||
get() { | ||
return ref.value?.[property]; | ||
}, | ||
set(v) { | ||
ref.value = ref.value | ||
? { | ||
...ref.value, | ||
[property]: v, | ||
} | ||
: undefined; | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const bmmLanguages = ["en", "no"] as const; |