forked from comses/comses.net
-
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.
refactor: form/field component renaming
- use more descripting prefixes for form components - some type/variable renaming - create src/types.ts for shared types and a `BaseFieldProps` for field components to extend
- Loading branch information
Showing
23 changed files
with
240 additions
and
280 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
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
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,34 @@ | ||
<template> | ||
<div> | ||
<div class="form-check"> | ||
<input | ||
v-model="value" | ||
type="checkbox" | ||
:id="id" | ||
v-bind="attrs" | ||
:class="{ 'form-check-input': true, 'is-invalid': error }" | ||
/> | ||
<FieldLabel v-if="label" :label="label" :id-for="id" :required="required" /> | ||
</div> | ||
<slot name="help"> | ||
<FieldHelp v-if="help" :help="help" :id-for="id" /> | ||
</slot> | ||
<slot name="error"> | ||
<FieldError v-if="error" :error="error" :id-for="id" /> | ||
</slot> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { useField } from "@/composables/form"; | ||
import FieldLabel from "@/components/form/FieldLabel.vue"; | ||
import FieldHelp from "@/components/form/FieldHelp.vue"; | ||
import FieldError from "@/components/form/FieldError.vue"; | ||
import type { BaseFieldProps } from "@/types"; | ||
const props = withDefaults(defineProps<BaseFieldProps>(), { | ||
help: "", | ||
}); | ||
const { id, value, attrs, error } = useField<boolean>(props, "name"); | ||
</script> |
Oops, something went wrong.