Skip to content

Latest commit

 

History

History
115 lines (85 loc) · 2.93 KB

README.md

File metadata and controls

115 lines (85 loc) · 2.93 KB

zappy-assessment

Frontend Assessment

tech stack

  • yarn
  • nextjs
  • typescript
  • tailwindcss
  • sass

typescript next.js example

yarn create next-app --example with-typescript with-typescript-app https://github.com/vercel/next.js/tree/canary/examples/with-typescript

tailwindcss next.js example

yarn create next-app --example with-tailwindcss with-tailwindcss-app https://github.com/vercel/next.js/tree/canary/examples/with-tailwindcss

tailwindcss in a next.js projects

1. Define a solid content model

Let's first think about what we're going to need

Each page will have an associated Form model. We'll pick 2 form field types:

  • Input
  • Checkbox

Models

Page

  • Title, String, Single line text, Required, and used as a Title
  • Slug, String, Slug, Required - Specify {title} as the template
  • Form, Reference to Form

Form

  • Page, Reference, Accepts multiple Page values
  • Fields, Reference, Accepts multiple FormInput, FormTextarea, FormSelect and FormCheckbox values

FormInput

  • Name, String
  • Type, Enum, FormInputType
  • Label, String
  • Placeholder, String
  • Required, Boolean
  • Form, Reference to Form

FormCheckbox

  • Name, String
  • Label, String, Required
  • Required, Boolean
  • Form, Reference to Form

Enumerations

FormInputType values

  • EMAIL
  • TEXT
  • DATE

2. Create an example Page and Form with Fields

FormInput's

  • Name

    • Name: name
    • Type: TEXT
    • Label: Name
    • Placeholder: Nome
    • Required: true
  • Email

    • Name: email
    • Type: EMAIL
    • Label: Email
    • Placeholder: Email
    • Required: true

FormInput's (read-only)

FormCheckbox

  • Hours of
    • Name: hour
    • Label: HH
    • Required: true

3. Query our Page, Form and Fields

We have three pages, with two separate forms and, a recap page.

  • Contact Form
  • Booking Form
  • Recap

4. Build Pages programmatically with Next.js

This comes in two significant parts. First we create the routes (or "paths") and then query for the data for each page with those path params.

5. Build our Form Field components

In this file, we will create the structure of our basic form, and map through each of our fields to return the appropreciate field.