Skip to content

Commit 8095cac

Browse files
Ruben van LeeuwenDutchBen
authored andcommitted
947: Add some information text on the example form
1 parent 74bde2a commit 8095cac

File tree

1 file changed

+36
-26
lines changed

1 file changed

+36
-26
lines changed

pages/example-form.tsx

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,25 @@ import React from 'react';
22

33
import { useRouter } from 'next/router';
44

5-
import { EuiSpacer } from '@elastic/eui';
5+
import {
6+
EuiFlexGroup,
7+
EuiFlexItem,
8+
EuiPageHeader,
9+
EuiSpacer,
10+
} from '@elastic/eui';
611
import { WfoUserInputForm } from '@orchestrator-ui/orchestrator-ui-components';
712
import type { InputForm } from '@orchestrator-ui/orchestrator-ui-components';
813

914
export function ExampleFormPage() {
1015
const router = useRouter();
1116

12-
const submit = (userInput: { [index: string]: unknown }) => {
13-
// eslint-disable-next-line no-console
14-
console.log(userInput);
15-
alert('See console for submitted form data');
17+
const submit = () => {
18+
alert('The form is submitted');
1619
return Promise.resolve();
1720
};
1821

1922
const cancel = () => {
20-
alert('the form is cancelled');
23+
alert('The form is cancelled');
2124
};
2225

2326
const formDefinition = {
@@ -76,11 +79,6 @@ export function ExampleFormPage() {
7679
enum: ['option1', 'option2', 'option3'],
7780
checkboxes: true,
7881
},
79-
acceptField: {
80-
title: 'Accept field',
81-
type: 'string',
82-
format: 'accept',
83-
},
8482
timestampField: {
8583
default: new Date().getTime(),
8684
format: 'timestamp',
@@ -121,25 +119,37 @@ export function ExampleFormPage() {
121119
format: 'customerId',
122120
},
123121
},
124-
title: 'Example form',
125122
type: 'object',
126123
};
127124

128125
return (
129-
<>
130-
<WfoUserInputForm
131-
key={'key'}
132-
router={router}
133-
stepUserInput={formDefinition as InputForm}
134-
validSubmit={submit}
135-
hasNext={false}
136-
hasPrev={false}
137-
cancel={cancel}
138-
previous={cancel}
139-
userInput={[]}
140-
/>
141-
<EuiSpacer />
142-
</>
126+
<EuiFlexGroup>
127+
<EuiFlexItem>
128+
<EuiPageHeader pageTitle="Example form" />
129+
<EuiSpacer />
130+
This page shows a sample of form fields that can be used to
131+
automatically create forms when creating workflows in the
132+
Workflow Orchestrator. For more information, see the
133+
<a
134+
href="https://workfloworchestrator.org/orchestrator-core/reference-docs/forms/"
135+
target="_blank"
136+
>
137+
Forms documentation
138+
</a>
139+
<EuiSpacer />
140+
<WfoUserInputForm
141+
key={'key'}
142+
router={router}
143+
stepUserInput={formDefinition as InputForm}
144+
validSubmit={submit}
145+
hasNext={false}
146+
hasPrev={false}
147+
cancel={cancel}
148+
previous={cancel}
149+
userInput={[]}
150+
/>
151+
</EuiFlexItem>
152+
</EuiFlexGroup>
143153
);
144154
}
145155

0 commit comments

Comments
 (0)