-
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.
Merge pull request #8 from openobserve/fix/bugs
Fix/bugs
- Loading branch information
Showing
8 changed files
with
624 additions
and
32 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,85 @@ | ||
<script setup> | ||
import { defineProps, defineEmits, ref, watch } from "vue"; | ||
const props = defineProps({ | ||
formFields: { | ||
type: Array, | ||
required: true, | ||
}, | ||
buttonText: { | ||
type: String, | ||
required: true, | ||
}, | ||
buttonVariant: { | ||
type: String, | ||
default: "primary", | ||
}, | ||
}); | ||
const formData = ref({}); | ||
// Initialize form data | ||
onMounted(() => { | ||
props.formFields.forEach((field) => { | ||
formData.value[field.name] = field.type === "checkbox" ? false : ""; | ||
}); | ||
}); | ||
const onSubmit = () => { | ||
console.log("Form submitted with data:", formData.value); | ||
}; | ||
</script> | ||
<template> | ||
<form @submit.prevent="onSubmit" class="space-y-6"> | ||
<div | ||
v-for="(field, index) in formFields" | ||
:key="index" | ||
class="flex flex-col" | ||
> | ||
<label :for="field.name" class="text-white font-medium mb-1"> | ||
{{ field.label }} | ||
</label> | ||
<input | ||
v-if="field.type === 'text'" | ||
:type="field.type" | ||
:id="field.name" | ||
:placeholder="field.placeholder" | ||
v-model="formData[field.name]" | ||
class="bg-[#23282C] border border-[#373a3d] rounded-lg p-3 focus:outline-none focus:ring-2 focus:ring-blue-500" | ||
/> | ||
<select | ||
v-else-if="field.type === 'select'" | ||
:id="field.name" | ||
v-model="formData[field.name]" | ||
class="bg-[#23282C] text-white border border-[#43484C] rounded-lg p-3 focus:outline-none focus:ring-2 focus:ring-blue-500" | ||
> | ||
<option v-for="option in field.options" :key="option" :value="option"> | ||
{{ option }} | ||
</option> | ||
</select> | ||
<textarea | ||
v-else-if="field.type === 'textarea'" | ||
:id="field.name" | ||
:placeholder="field.placeholder" | ||
v-model="formData[field.name]" | ||
class="bg-[#23282C] border border-[#43484C] rounded-lg p-3 focus:outline-none focus:ring-2 focus:ring-blue-500" | ||
></textarea> | ||
</div> | ||
|
||
<!-- Checkbox --> | ||
<div class="flex items-start gap-3"> | ||
<input type="checkbox" id="terms" v-model="formData.terms" class="mt-1" /> | ||
<label for="terms" class="text-gray-600"> | ||
I confirm I have read and agree to the | ||
<a href="#" class="text-blue-500 underline">Terms and Conditions</a>. | ||
</label> | ||
</div> | ||
|
||
<!-- Submit Button --> | ||
<div> | ||
<CustomButton :variant="buttonVariant" type="submit"> | ||
{{ buttonText }} | ||
</CustomButton> | ||
</div> | ||
</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
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