Skip to content

Commit

Permalink
updated intro and nav
Browse files Browse the repository at this point in the history
  • Loading branch information
Smef committed Jun 8, 2024
1 parent c29ccb7 commit 3851f46
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 25 deletions.
2 changes: 1 addition & 1 deletion playground/components/LabeledInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ defineEmits(["change"]);
:id="id"
v-model="model"
:name="name"
class="rounded-md px-2 py-1"
class="rounded-md bg-gray-950 px-2 py-1"
@change="$emit('change')"
/>
<div v-for="error in errors" :key="error" class="text-red-500">
Expand Down
28 changes: 24 additions & 4 deletions playground/components/nav/NavBar.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
<script setup lang="ts">
import ContentWidthContainer from "~/components/ContentWidthContainer.vue";
const route = useRoute();
const activeClasses = (location) => {
if (location === route.path) {
return "border-b-4 border-blue-500";
}
return "border-b-4 border-transparent";
};
const links = [
{ name: "Home", path: "/" },
{ name: "Register", path: "/register" },
{ name: "Register-Precognition", path: "/register-precog" },
];
</script>

<template>
<div class="bg-gray-900">
<ContentWidthContainer>
<div class="flex justify-between">
<div class="flex">
<NuxtLink href="/" class="px-4 py-2 hover:bg-gray-800"> Home </NuxtLink>

<NuxtLink href="/register" class="px-4 py-2 hover:bg-gray-800"> Register </NuxtLink>
<NuxtLink href="/register-precog" class="px-4 py-2 hover:bg-gray-800"> Register-Precognition </NuxtLink>
<NuxtLink
v-for="link in links"
:href="link.path"
class="px-4 pb-2 pt-4 hover:bg-gray-800"
:class="activeClasses(link.path)"
>
{{ link.name }}
</NuxtLink>
</div>
</div>
</ContentWidthContainer>
Expand Down
41 changes: 21 additions & 20 deletions playground/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,28 @@
<template>
<div class="prose prose-invert">
<h1>Nuxt Precognition Example</h1>
<div>
<p>This is a playground for testing the Nuxt Precognition module.</p>
<p>There are two different registration form examples which you can try out:</p>
<p>
The first "Register" is a form which uses the <code>useForm</code> composable. Form data is sent to the server
and validated upons submission.
</p>
<p>
The useForm composable is used to provide some very convenient lifecycle hooks for the form, as well as nice
validation and error handling.
</p>
<p>This is a playground for testing the Nuxt Precognition module.</p>
<p>There are two different registration form examples which you can try out.</p>
<h2>Register Form</h2>
<p>
The first "Register" is a form which uses the <code>useForm</code> composable. Form data is sent to the server and
validated upons submission.
</p>
<p>
The useForm composable is used to provide some very convenient lifecycle hooks for the form, as well as nice
validation and error handling.
</p>

<NuxtLink to="/register-form">Register Form</NuxtLink>
<NuxtLink to="/register-form">Register Form</NuxtLink>

<p>The second "Register-Precog"is a form which uses the <code>usePrecognitionForm</code> composable.</p>
<p>
In addition to the features of the <code>useForm</code> composable, the usePrecognitionForm composable also
provides a <code>validate</code> method which can be used to validate the form data before the form is
submitted. This method is called on the @change hook of the inputs to validate as the user is entering data.
</p>
<NuxtLink to="/register-precog">Register Precognition</NuxtLink>
</div>
<h2>Register Form with Precognition</h2>

<p>The second "Register-Precog"is a form which uses the <code>usePrecognitionForm</code> composable.</p>
<p>
In addition to the features of the <code>useForm</code> composable, the usePrecognitionForm composable also
provides a <code>validate</code> method which can be used to validate the form data before the form is submitted.
This method is called on the @change hook of the inputs to validate as the user is entering data.
</p>
<NuxtLink to="/register-precog">Register with Precognition</NuxtLink>
</div>
</template>

0 comments on commit 3851f46

Please sign in to comment.