-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I thought the TextInput would be an easy component to start with. I was wrong, but hey, at least this mostly works. I also left some TODOs in the code as a treat. Bug: T369505
- Loading branch information
1 parent
8396f13
commit 5d80288
Showing
5 changed files
with
167 additions
and
19 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,6 +1,6 @@ | ||
<script setup lang="ts"> | ||
import { TextInput } from '@wmde/wikit-vue-components'; | ||
import RequiredAsterisk from '@/components/RequiredAsterisk.vue'; | ||
import { CdxField, CdxTextInput } from '@wikimedia/codex'; | ||
import RequiredAsterisk from '@/components/RequiredAsterisk.vue'; // eslint-disable-line @typescript-eslint/no-unused-vars | ||
import { useMessages } from '@/plugins/MessagesPlugin/Messages'; | ||
import { useConfig } from '@/plugins/ConfigPlugin/Config'; | ||
import { useStore } from 'vuex'; | ||
|
@@ -51,23 +51,32 @@ export default { | |
</script> | ||
|
||
<template> | ||
<text-input | ||
class="wbl-snl-lemma-input" | ||
:label="messages.getUnescaped( 'wikibaselexeme-newlexeme-lemma' )" | ||
:placeholder="messages.getUnescaped( | ||
'wikibaselexeme-newlexeme-lemma-placeholder-with-example', | ||
exampleLemma | ||
)" | ||
name="lemma" | ||
aria-required="true" | ||
:error="error" | ||
:value="modelValue" | ||
@input="$emit( 'update:modelValue', $event )" | ||
<!-- TODO should :status and :messages be separate computeds? --> | ||
<cdx-field | ||
:status="error !== null ? 'error' : 'default'" | ||
:messages="error !== null ? { error: error.message } : {}" | ||
> | ||
<template #suffix> | ||
<required-asterisk /> | ||
</template> | ||
</text-input> | ||
<!-- TODO check escaping of :placeholder --> | ||
<cdx-text-input | ||
class="wbl-snl-lemma-input" | ||
:placeholder="messages.getUnescaped( | ||
'wikibaselexeme-newlexeme-lemma-placeholder-with-example', | ||
exampleLemma | ||
)" | ||
name="lemma" | ||
aria-required="true" | ||
:model-value="modelValue" | ||
@update:modelValue="$emit( 'update:modelValue', $event )" | ||
Check warning on line 69 in src/components/LemmaInput.vue GitHub Actions / code-quality
|
||
> | ||
<!-- TODO codex docs say don’t mark required labels with an asterisk… | ||
<template #suffix> | ||
<required-asterisk /> | ||
</template> | ||
--> | ||
</cdx-text-input> | ||
<template #label>{{ messages.getUnescaped( 'wikibaselexeme-newlexeme-lemma' ) }}</template><!-- TODO check escaping --> | ||
Check warning on line 77 in src/components/LemmaInput.vue GitHub Actions / code-quality
Check warning on line 77 in src/components/LemmaInput.vue GitHub Actions / code-quality
|
||
</cdx-field> | ||
|
||
</template> | ||
|
||
<style lang="scss"> | ||
|
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