Skip to content

Commit 69ad97a

Browse files
committed
add titles, isFirst
1 parent 325da63 commit 69ad97a

File tree

14 files changed

+84
-14
lines changed

14 files changed

+84
-14
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import type { PropsWithChildren } from 'react';
2+
import type { Metadata } from 'next';
3+
4+
export const metadata: Metadata = {
5+
title: 'Very Long Building Form',
6+
};
7+
export default function Layout({ children }: PropsWithChildren) {
8+
return <>{children}</>;
9+
}

docs/src/app/demos/layout.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
import type { PropsWithChildren } from 'react';
22
import { Header } from '../header';
3+
import type { Metadata } from 'next';
4+
5+
export const metadata: Metadata = {
6+
title: {
7+
template: '%s | Demos',
8+
default: 'Demos',
9+
},
10+
};
311

412
export default function DemoLayout({ children }: PropsWithChildren) {
513
return (

docs/src/app/demos/petrock/layout.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import type { PropsWithChildren } from 'react';
2+
import type { Metadata } from 'next';
3+
4+
export const metadata: Metadata = {
5+
title: 'Pet Rock Registration',
6+
};
7+
export default function Layout({ children }: PropsWithChildren) {
8+
return <>{children}</>;
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import type { PropsWithChildren } from 'react';
2+
import type { Metadata } from 'next';
3+
4+
export const metadata: Metadata = {
5+
title: 'Small Form',
6+
};
7+
export default function Layout({ children }: PropsWithChildren) {
8+
return <>{children}</>;
9+
}

docs/src/app/demos/two-pager/page.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const FirstPage = (props: FormComponentProps<FormModel>) => {
2424
{...register('name', {
2525
// required: true,
2626
validate: (v) => {
27-
console.log(v);
2827
if (!v) {
2928
return 'Name is required';
3029
}
@@ -75,13 +74,11 @@ const sequence: SequenceChild<
7574
{
7675
id: 'first',
7776
isComplete: (data) => !!data.name?.length,
78-
validate: () => undefined,
7977
Component: FirstPage,
8078
},
8179
{
8280
id: 'second',
8381
isComplete: (data) => !!data.pet?.length,
84-
validate: () => undefined,
8582
Component: SecondPage,
8683
},
8784
] as const;

docs/src/app/docs/api/page.md renamed to docs/src/app/docs/api/page.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
export const metadata = {
2+
title: 'API Reference'
3+
}
4+
15
# API
26

37
The API consists of a few items:
@@ -124,6 +128,7 @@ export function MyMultiPageForm() {
124128
goBack, // goes back one page
125129
goTo, // goes to a page by id
126130
isFinal, // if this is the last page
131+
isFirst, // if this is the first page in the sequence
127132
} = useMultiPageHookForm<MyDataType, MyComponentProps>({
128133
hookForm,
129134
pages: [myPage, mySequence],

docs/src/app/docs/complex-flows/page.md renamed to docs/src/app/docs/complex-flows/page.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
export const metadata = {
2+
title: 'Complex Flows'
3+
}
4+
15
# Large and Complex Flows
26

37
Let's say you are building an onboarding flow for an app that allows users to search doctors and schedule appointments. There are a lot of details in this flow, including insurances, video, existing software, and more. Bureaucracy has made this hard on everyone. There are parts of this form that require specialized knowledge of insurances and bureaucracy, health care specialties, and even software integration. Different team members may need to review various parts of this workflow due to specialized knowledge requirements.

docs/src/app/docs/page.md renamed to docs/src/app/docs/page.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
export const metadata = {
2+
title: 'Getting Started'
3+
}
4+
15
# Getting Started
26

37
This guide will help you get started using React Multi Page Form in combination with React Hook Form and TypeScript. For other form libraries, such as Formik or React Final Form, you will need to implement page level validation in an `onBeforePageChange` listener and a `getCurrentData` method. If you're not using typescript, you can skip the schema and component prop types.

docs/src/app/docs/testing/page.md renamed to docs/src/app/docs/testing/page.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
export const metadata = {
2+
title: 'Testing Your Code'
3+
}
4+
15
# Testing Forms and Sequences
26

37
React Multi Page Forms provides two tools to make testing and development easier.

docs/src/app/docs/using/page.md renamed to docs/src/app/docs/using/page.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
export const metadata = {
2+
title: 'Using'
3+
}
4+
15
# Using React Multi Page Form
26

37
## `isComplete` vs `validate`

0 commit comments

Comments
 (0)