From 13e5d967ce36dbe0c5dc90972e0f5d7482d807d2 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Thu, 27 Oct 2022 21:46:17 +0200 Subject: [PATCH] Fix missing children --- components/common/Link.tsx | 1 + .../domain/wishes/createWish/CreateWish.tsx | 15 ++++++++------ .../layout/authentication/AuthLayout.tsx | 20 ++++++++++++------- components/layout/home/HomeLayout.tsx | 7 ++++--- pages/index.tsx | 5 +++-- 5 files changed, 30 insertions(+), 18 deletions(-) diff --git a/components/common/Link.tsx b/components/common/Link.tsx index 75d9daf..5b995be 100644 --- a/components/common/Link.tsx +++ b/components/common/Link.tsx @@ -4,6 +4,7 @@ import NextLink from 'next/link' interface LinkProps { page: string className: string + children?: React.ReactNode } const Link: FC = (props) => ( diff --git a/components/domain/wishes/createWish/CreateWish.tsx b/components/domain/wishes/createWish/CreateWish.tsx index b2755c7..4bb6c29 100644 --- a/components/domain/wishes/createWish/CreateWish.tsx +++ b/components/domain/wishes/createWish/CreateWish.tsx @@ -1,13 +1,12 @@ -import { FC, FormEvent, SyntheticEvent, useEffect, useState } from 'react' -import { result } from '../../../common/result' -import { createWish, Wish } from '../models' -import { v4 as uuid } from 'uuid' +import { FC, ReactNode } from 'react' +import { Wish } from '../models' interface CreateWishProps { onFocus: () => void hasFocus: boolean onSubmit: (wish: Wish) => void wish: Wish + children?: ReactNode } const CreateWish: FC = (props) => { @@ -19,7 +18,7 @@ const CreateWish: FC = (props) => { type="text" name="wishName" 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) => props.onSubmit({ ...props.wish, name: e.target.value }) } @@ -37,6 +36,7 @@ const CreateWish: FC = (props) => { interface InnerWishPromptInterface { wish: Wish onChange: (wish: Wish) => void + children?: ReactNode } const InnerWishPrompt: FC = (props) => { @@ -66,7 +66,10 @@ const InnerWishPrompt: FC = (props) => { ) } -export const BasePrompt: FC = (props) => ( +interface BasePromptProps { + children?: ReactNode +} +export const BasePrompt: FC = (props) => (
{props.children}
diff --git a/components/layout/authentication/AuthLayout.tsx b/components/layout/authentication/AuthLayout.tsx index 234ebb4..0181f01 100644 --- a/components/layout/authentication/AuthLayout.tsx +++ b/components/layout/authentication/AuthLayout.tsx @@ -1,13 +1,16 @@ -import { FC } from 'react' +import { FC, ReactNode } from 'react' import styles from './AuthLayout.module.scss' -const AuthLayout: FC = (props) => ( +interface AuthLayoutProps { + children?: ReactNode +} +const AuthLayout: FC = ({ children }) => (
-
) @@ -16,13 +19,14 @@ interface AuthFieldProps { name: string required?: boolean type: 'text' | 'password' + children?: ReactNode } const AuthField: FC = (props) => { return (
@@ -30,7 +34,7 @@ const AuthField: FC = (props) => { type="text" name={props.name} 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" />
) @@ -39,6 +43,7 @@ const AuthField: FC = (props) => { interface AuthPasswordProps { name: string required?: boolean + children?: ReactNode } export const AuthPassword: FC = (props) => ( @@ -47,6 +52,7 @@ export const AuthPassword: FC = (props) => ( interface AuthInputProps { name: string required?: boolean + children?: ReactNode } export const AuthInput: FC = (props) => ( diff --git a/components/layout/home/HomeLayout.tsx b/components/layout/home/HomeLayout.tsx index 3593e03..77a02ac 100644 --- a/components/layout/home/HomeLayout.tsx +++ b/components/layout/home/HomeLayout.tsx @@ -1,15 +1,16 @@ -import { FC, ReactElement } from 'react' +import { FC, ReactElement, ReactNode } from 'react' import { inspect } from 'util' import styles from './HomeLayout.module.scss' interface HomeLayoutProps { page: string + children?: ReactNode } const HomeLayout: FC = (props) => { return ( -
+
-

+

Wishes / {props.page} diff --git a/pages/index.tsx b/pages/index.tsx index 0e45efc..1abb58a 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,9 +1,10 @@ import type { NextPage } from 'next' import Link from 'next/link' -import { FC } from 'react' +import { FC, ReactNode } from 'react' interface CtaLinkProps { page: string + children?: ReactNode } const CtaLink: FC = (props) => ( @@ -14,7 +15,7 @@ const CtaLink: FC = (props) => ( const Home: NextPage = () => { return (
-
+

Wishes

Create account