Update FormsDoc.vue

pull/6674/head
Cagatay Civici 2024-10-29 00:22:08 +03:00
parent 1ebcc4b3aa
commit 1817467bfd
1 changed files with 39 additions and 39 deletions

View File

@ -4,14 +4,15 @@
</DocSectionText> </DocSectionText>
<div class="card flex justify-center"> <div class="card flex justify-center">
<div class="flex flex-col gap-4"> <div class="flex flex-col gap-4">
<Message severity="error" icon="pi pi-times-circle" class="mb-2">Validation Failed</Message> <Message v-if="!username || !email" severity="error" icon="pi pi-times-circle" class="mb-2">Validation error</Message>
<div class="flex flex-col"> <Message v-if="username && email" severity="success" icon="pi pi-times-circle" class="mb-2">Form is valid</Message>
<InputText placeholder="Username" aria-label="username" invalid /> <div class="flex flex-col gap-1">
<Message severity="error" variant="plain" size="small">Username is required</Message> <InputText v-model="username" placeholder="Username" aria-label="username" :invalid="!username" />
<Message v-if="!username" severity="error" variant="simple" size="small">Username is required</Message>
</div> </div>
<div class="flex flex-col"> <div class="flex flex-col gap-1">
<InputText placeholder="Email" aria-label="email" invalid /> <InputText v-model="email" placeholder="Email" aria-label="email" :invalid="!email" />
<Message severity="error" variant="plain" size="small">Email is not valid</Message> <Message v-if="!email" severity="error" variant="simple" size="small">Email is not valid</Message>
</div> </div>
</div> </div>
</div> </div>
@ -22,33 +23,33 @@
export default { export default {
data() { data() {
return { return {
username: null,
email: null,
code: { code: {
basic: ` basic: `
<div class="flex flex-col gap-4"> <Message v-if="!username || !email" severity="error" icon="pi pi-times-circle" class="mb-2">Validation error</Message>
<Message severity="error" icon="pi pi-times-circle" class="mb-2">Validation Failed</Message> <Message v-if="username && email" severity="success" icon="pi pi-times-circle" class="mb-2">Form is valid</Message>
<div class="flex flex-col"> <div class="flex flex-col gap-1">
<InputText placeholder="Username" aria-label="username" invalid /> <InputText v-model="username" placeholder="Username" aria-label="username" :invalid="!username" />
<Message severity="error" variant="plain" size="small">Username is required</Message> <Message v-if="!username" severity="error" variant="simple" size="small">Username is required</Message>
</div> </div>
<div class="flex flex-col"> <div class="flex flex-col gap-1">
<InputText placeholder="Email" aria-label="email" invalid /> <InputText v-model="email" placeholder="Email" aria-label="email" :invalid="!email" />
<Message severity="error" variant="plain" size="small">Email is not valid</Message> <Message v-if="!email" severity="error" variant="simple" size="small">Email is not valid</Message>
</div>
</div> </div>
`, `,
options: ` options: `
<template> <template>
<div class="card flex justify-center">
<div class="flex flex-col gap-4"> <div class="flex flex-col gap-4">
<Message severity="error" icon="pi pi-times-circle" class="mb-2">Validation Failed</Message> <Message v-if="!username || !email" severity="error" icon="pi pi-times-circle" class="mb-2">Validation error</Message>
<div class="flex flex-col"> <Message v-if="username && email" severity="success" icon="pi pi-times-circle" class="mb-2">Form is valid</Message>
<InputText placeholder="Username" aria-label="username" invalid /> <div class="flex flex-col gap-1">
<Message severity="error" variant="plain" size="small">Username is required</Message> <InputText v-model="username" placeholder="Username" aria-label="username" :invalid="!username" />
</div> <Message v-if="!username" severity="error" variant="simple" size="small">Username is required</Message>
<div class="flex flex-col">
<InputText placeholder="Email" aria-label="email" invalid />
<Message severity="error" variant="plain" size="small">Email is not valid</Message>
</div> </div>
<div class="flex flex-col gap-1">
<InputText v-model="email" placeholder="Email" aria-label="email" :invalid="!email" />
<Message v-if="!email" severity="error" variant="simple" size="small">Email is not valid</Message>
</div> </div>
</div> </div>
</template> </template>
@ -58,17 +59,16 @@ export default {
`, `,
composition: ` composition: `
<template> <template>
<div class="card flex justify-center">
<div class="flex flex-col gap-4"> <div class="flex flex-col gap-4">
<Message severity="error" icon="pi pi-times-circle" class="mb-2">Validation Failed</Message> <Message v-if="!username || !email" severity="error" icon="pi pi-times-circle" class="mb-2">Validation error</Message>
<div class="flex flex-col"> <Message v-if="username && email" severity="success" icon="pi pi-times-circle" class="mb-2">Form is valid</Message>
<InputText placeholder="Username" aria-label="username" invalid /> <div class="flex flex-col gap-1">
<Message severity="error" variant="plain" size="small">Username is required</Message> <InputText v-model="username" placeholder="Username" aria-label="username" :invalid="!username" />
</div> <Message v-if="!username" severity="error" variant="simple" size="small">Username is required</Message>
<div class="flex flex-col">
<InputText placeholder="Email" aria-label="email" invalid />
<Message severity="error" variant="plain" size="small">Email is not valid</Message>
</div> </div>
<div class="flex flex-col gap-1">
<InputText v-model="email" placeholder="Email" aria-label="email" :invalid="!email" />
<Message v-if="!email" severity="error" variant="simple" size="small">Email is not valid</Message>
</div> </div>
</div> </div>
</template> </template>