Chore clean up demo app (#165)

* feat(demo): new nav component

* refactor: remove hr
This commit is contained in:
Ayo Ayco 2022-10-29 21:26:11 +02:00 committed by GitHub
parent 6d9907a06c
commit d5c2b7786d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 62 additions and 39 deletions

View file

@ -1,7 +1,4 @@
import { defineConfig } from 'astro/config';
import tailwind from '@astrojs/tailwind';
import { defineConfig } from "astro/config";
// https://astro.build/config
export default defineConfig({
integrations: [tailwind()]
});
export default defineConfig({});

View file

@ -0,0 +1,8 @@
---
---
<nav>
<a href="/">Home</a> | <a href="/pizza-delivery">Pizza Delivery</a> | <a
href="/job-application">Job Application</a
>
</nav>

View file

@ -1,4 +1,5 @@
---
import Nav from "../components/Nav.astro";
import Form, {
ControlConfig,
FormGroup,
@ -34,8 +35,9 @@ const form = new FormGroup([
name: "agreement",
label: "Agreement",
type: "radio",
value: "yes",
options: [
{ label: "Agree", value: "yes", checked: true },
{ label: "Agree", value: "yes" },
{ label: "Disagree", value: "no" },
],
},
@ -83,7 +85,7 @@ const theme = "dark";
<title>Astro</title>
</head>
<body class={theme}>
<nav>Examples: <a href="/pizza-delivery">Pizza Delivery</a> | <a href="/job-application">Job Application</a></nav>
<Nav />
<h1>Astro Reactive Form</h1>
<Form showValidationHints={true} formGroups={form} theme={theme} />
<style>

View file

@ -1,10 +1,12 @@
---
import Nav from "../components/Nav.astro";
import Form, {
ControlConfig,
FormControl,
FormGroup,
} from "@astro-reactive/form";
import { Validators } from "@astro-reactive/validator";
import type { Submit } from "@astro-reactive/common";
const infoForm = new FormGroup([
{
@ -33,7 +35,15 @@ const infoForm = new FormGroup([
name: "country",
label: "Country of Residence",
type: "dropdown",
options: ["U.S.A", "Canada", "Mexico", "Cuba", "Guatamala", "Greenland", "Haiti"],
options: [
"U.S.A",
"Canada",
"Mexico",
"Cuba",
"Guatamala",
"Greenland",
"Haiti",
],
placeholder: "Choose Your Country",
},
{
@ -41,14 +51,14 @@ const infoForm = new FormGroup([
label: "Are you eligible to work?",
type: "radio",
options: [
{ label: "Yes", value: "yes"},
{ label: "Yes", value: "yes" },
{ label: "No", value: "no" },
],
},
]);
const skillsForm = new FormGroup([
{
{
name: "js",
label: "Javascript",
type: "checkbox",
@ -86,17 +96,15 @@ const resume: ControlConfig = {
type: "file",
};
const submit: ControlConfig = {
const submit: Submit = {
name: "submit",
type: "submit",
};
infoForm.name = "Application Form";
skillsForm.name = "Skills"
skillsForm.name = "Skills";
skillsForm.controls.push(new FormControl(resume));
---
<html lang="en">
@ -108,34 +116,41 @@ skillsForm.controls.push(new FormControl(resume));
<title>Astro</title>
</head>
<body class="bg-gray-100 text-gray-900 tracking-wider leading-normal">
<!-- Navbar -->
<nav class="bg-sky-300 fixed w-full z-10 top-0 shadow text-xl pl-3">Examples: <a href="/">Home</a> | <a href="/pizza-delivery">Pizza Delivery</a></nav>
<Nav />
<!-- Title -->
<div class="items-center mt-10">
<h1 class="items-center text-center font-sans font-bold break-normal text-gray-700 px-2 text-xl mt-12 lg:mt-0 md:text-5xl">Programmer Job Application</h1>
<h1
class="items-center text-center font-sans font-bold break-normal text-gray-700 px-2 text-xl mt-12 lg:mt-0 md:text-5xl"
>
Programmer Job Application
</h1>
</div>
<!--Container-->
<div class="container w-full flex flex-wrap mx-auto px-2 pt-8 lg:pt-10 mt-4">
<!-- Section -->
<section class="w-full">
<div
class="container w-full flex flex-wrap mx-auto px-2 pt-8 lg:pt-10 mt-4"
>
<!-- Section -->
<section class="w-full">
<!-- Header -->
<h2
id="section1"
class="font-sans font-bold break-normal text-gray-700 px-2 pb-4 text-xl"
>
Enter your information
</h2>
<!-- Horizontal Rule -->
<hr class="bg-gray-300 w-full">
<!-- Header -->
<h2 id='section1' class="font-sans font-bold break-normal text-gray-700 px-2 pb-4 text-xl">Enter your information</h2>
<!-- Form -->
<div class="p-8 mt-6 lg:mt-0 leading-normal rounded shadow bg-slate-200">
<Form showValidationHints={true} formGroups={[infoForm, skillsForm]} submitControl={submit}></Form>
</div>
</section>
</div>
<!-- Form -->
<div
class="p-8 mt-6 lg:mt-0 leading-normal rounded shadow bg-slate-200"
>
<Form
showValidationHints={true}
formGroups={[infoForm, skillsForm]}
submitControl={submit}
/>
</div>
</section>
</div>
</body>
</html>

View file

@ -1,4 +1,5 @@
---
import Nav from "../components/Nav.astro";
import Form, { FormGroup } from "@astro-reactive/form";
import { Validators } from "@astro-reactive/validator";
@ -98,7 +99,7 @@ infoForm.name = "Customer Info";
<title>Astro</title>
</head>
<body>
<nav><a href="/">Home</a> | <a href="/job-application">Job Application</a></nav>
<Nav />
<h1>Pizza Form Demo</h1>
<Form
showValidationHints={true}