Fix missing children
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing

This commit is contained in:
Kasper Juul Hermansen 2022-10-27 21:46:17 +02:00
parent e21c3397c2
commit 13e5d967ce
Signed by: kjuulh
GPG Key ID: 0F95C140730F2F23
5 changed files with 30 additions and 18 deletions

View File

@ -4,6 +4,7 @@ import NextLink from 'next/link'
interface LinkProps { interface LinkProps {
page: string page: string
className: string className: string
children?: React.ReactNode
} }
const Link: FC<LinkProps> = (props) => ( const Link: FC<LinkProps> = (props) => (
<NextLink href={props.page}> <NextLink href={props.page}>

View File

@ -1,13 +1,12 @@
import { FC, FormEvent, SyntheticEvent, useEffect, useState } from 'react' import { FC, ReactNode } from 'react'
import { result } from '../../../common/result' import { Wish } from '../models'
import { createWish, Wish } from '../models'
import { v4 as uuid } from 'uuid'
interface CreateWishProps { interface CreateWishProps {
onFocus: () => void onFocus: () => void
hasFocus: boolean hasFocus: boolean
onSubmit: (wish: Wish) => void onSubmit: (wish: Wish) => void
wish: Wish wish: Wish
children?: ReactNode
} }
const CreateWish: FC<CreateWishProps> = (props) => { const CreateWish: FC<CreateWishProps> = (props) => {
@ -19,7 +18,7 @@ const CreateWish: FC<CreateWishProps> = (props) => {
type="text" type="text"
name="wishName" name="wishName"
placeholder="Your wish!" placeholder="Your wish!"
className="w-full appearance-none bg-pink-100 p-6 text-center text-xl outline-none font-medium" className="w-full appearance-none bg-pink-100 p-6 text-center text-xl font-medium outline-none"
onChange={(e) => onChange={(e) =>
props.onSubmit({ ...props.wish, name: e.target.value }) props.onSubmit({ ...props.wish, name: e.target.value })
} }
@ -37,6 +36,7 @@ const CreateWish: FC<CreateWishProps> = (props) => {
interface InnerWishPromptInterface { interface InnerWishPromptInterface {
wish: Wish wish: Wish
onChange: (wish: Wish) => void onChange: (wish: Wish) => void
children?: ReactNode
} }
const InnerWishPrompt: FC<InnerWishPromptInterface> = (props) => { const InnerWishPrompt: FC<InnerWishPromptInterface> = (props) => {
@ -66,7 +66,10 @@ const InnerWishPrompt: FC<InnerWishPromptInterface> = (props) => {
) )
} }
export const BasePrompt: FC = (props) => ( interface BasePromptProps {
children?: ReactNode
}
export const BasePrompt: FC<BasePromptProps> = (props) => (
<div> <div>
<div className="space-y-6 bg-white p-4 shadow">{props.children}</div> <div className="space-y-6 bg-white p-4 shadow">{props.children}</div>
</div> </div>

View File

@ -1,13 +1,16 @@
import { FC } from 'react' import { FC, ReactNode } from 'react'
import styles from './AuthLayout.module.scss' import styles from './AuthLayout.module.scss'
const AuthLayout: FC = (props) => ( interface AuthLayoutProps {
children?: ReactNode
}
const AuthLayout: FC<AuthLayoutProps> = ({ children }) => (
<div className={`${styles.root} min-h-screen`}> <div className={`${styles.root} min-h-screen`}>
<aside className="bg-pink-300 flex justify-center items-center"> <aside className="flex items-center justify-center bg-pink-300">
<h1 className="text-4xl">Wishes</h1> <h1 className="text-4xl">Wishes</h1>
</aside> </aside>
<main className="flex flex-col justify-center items-center"> <main className="flex flex-col items-center justify-center">
<div>{props.children}</div> <div>{children}</div>
</main> </main>
</div> </div>
) )
@ -16,13 +19,14 @@ interface AuthFieldProps {
name: string name: string
required?: boolean required?: boolean
type: 'text' | 'password' type: 'text' | 'password'
children?: ReactNode
} }
const AuthField: FC<AuthFieldProps> = (props) => { const AuthField: FC<AuthFieldProps> = (props) => {
return ( return (
<div> <div>
<label <label
htmlFor={props.name} htmlFor={props.name}
className="block text-gray-800 text-sm font-bold mb-2" className="mb-2 block text-sm font-bold text-gray-800"
> >
{props.children} {props.children}
</label> </label>
@ -30,7 +34,7 @@ const AuthField: FC<AuthFieldProps> = (props) => {
type="text" type="text"
name={props.name} name={props.name}
required required
className="appearance-none border rounded w-full py-2 px-3 text-gray-800 leading-tight" className="w-full appearance-none rounded border py-2 px-3 leading-tight text-gray-800"
/> />
</div> </div>
) )
@ -39,6 +43,7 @@ const AuthField: FC<AuthFieldProps> = (props) => {
interface AuthPasswordProps { interface AuthPasswordProps {
name: string name: string
required?: boolean required?: boolean
children?: ReactNode
} }
export const AuthPassword: FC<AuthPasswordProps> = (props) => ( export const AuthPassword: FC<AuthPasswordProps> = (props) => (
<AuthField {...props} type="password" /> <AuthField {...props} type="password" />
@ -47,6 +52,7 @@ export const AuthPassword: FC<AuthPasswordProps> = (props) => (
interface AuthInputProps { interface AuthInputProps {
name: string name: string
required?: boolean required?: boolean
children?: ReactNode
} }
export const AuthInput: FC<AuthPasswordProps> = (props) => ( export const AuthInput: FC<AuthPasswordProps> = (props) => (
<AuthField {...props} type="text" /> <AuthField {...props} type="text" />

View File

@ -1,15 +1,16 @@
import { FC, ReactElement } from 'react' import { FC, ReactElement, ReactNode } from 'react'
import { inspect } from 'util' import { inspect } from 'util'
import styles from './HomeLayout.module.scss' import styles from './HomeLayout.module.scss'
interface HomeLayoutProps { interface HomeLayoutProps {
page: string page: string
children?: ReactNode
} }
const HomeLayout: FC<HomeLayoutProps> = (props) => { const HomeLayout: FC<HomeLayoutProps> = (props) => {
return ( return (
<div className="bg-pink-50 min-h-screen"> <div className="min-h-screen bg-pink-50">
<div className={styles.root + ' space-x-6 pt-14'}> <div className={styles.root + ' space-x-6 pt-14'}>
<h1 className="text-2xl space-x-2 transition-all"> <h1 className="space-x-2 text-2xl transition-all">
<span>Wishes</span> <span>Wishes</span>
<span>/</span> <span>/</span>
<span>{props.page}</span> <span>{props.page}</span>

View File

@ -1,9 +1,10 @@
import type { NextPage } from 'next' import type { NextPage } from 'next'
import Link from 'next/link' import Link from 'next/link'
import { FC } from 'react' import { FC, ReactNode } from 'react'
interface CtaLinkProps { interface CtaLinkProps {
page: string page: string
children?: ReactNode
} }
const CtaLink: FC<CtaLinkProps> = (props) => ( const CtaLink: FC<CtaLinkProps> = (props) => (
<Link href={props.page}> <Link href={props.page}>
@ -14,7 +15,7 @@ const CtaLink: FC<CtaLinkProps> = (props) => (
const Home: NextPage = () => { const Home: NextPage = () => {
return ( return (
<div className="flex min-h-screen flex-col items-center justify-center bg-pink-400"> <div className="flex min-h-screen flex-col items-center justify-center bg-pink-400">
<main className="space-y-8 flex flex-col items-center"> <main className="flex flex-col items-center space-y-8">
<h1 className="text-6xl">Wishes</h1> <h1 className="text-6xl">Wishes</h1>
<div className="space-x-3"> <div className="space-x-3">
<CtaLink page="/sign-up">Create account</CtaLink> <CtaLink page="/sign-up">Create account</CtaLink>