-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathindex.tsx
More file actions
77 lines (67 loc) · 2.32 KB
/
index.tsx
File metadata and controls
77 lines (67 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import React from 'react';
import { Content, Form, FormGroup, Title } from '@patternfly/react-core';
import {
changeBlueprintDescription,
changeBlueprintName,
selectBlueprintDescription,
selectBlueprintName,
setIsCustomName,
} from '@/store/slices/wizard';
import { useAppDispatch, useAppSelector } from '../../../../store/hooks';
import { useDetailsValidation } from '../../utilities/useValidation';
import { ValidatedInputAndTextArea } from '../../ValidatedInput';
const DetailsStep = () => {
const dispatch = useAppDispatch();
const blueprintName = useAppSelector(selectBlueprintName);
const blueprintDescription = useAppSelector(selectBlueprintDescription);
const handleNameChange = (
_event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>,
name: string,
) => {
dispatch(changeBlueprintName(name));
dispatch(setIsCustomName());
};
const handleDescriptionChange = (
_event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>,
description: string,
) => {
dispatch(changeBlueprintDescription(description));
};
const stepValidation = useDetailsValidation();
return (
<Form>
<Title headingLevel='h1' size='xl'>
Image details
</Title>
<Content>
Enter a name and description to identify your deployment-ready image.
</Content>
<FormGroup isRequired label='Name' fieldId='blueprint-name'>
<ValidatedInputAndTextArea
ariaLabel='blueprint name'
dataTestId='blueprint'
value={blueprintName}
onChange={handleNameChange}
placeholder='Add blueprint name'
stepValidation={stepValidation}
fieldName='name'
isRequired={true}
handleClear={() => dispatch(changeBlueprintName(''))}
/>
</FormGroup>
<FormGroup label='Description' fieldId='blueprint-description-name'>
<ValidatedInputAndTextArea
ariaLabel='blueprint description'
dataTestId='blueprint description'
value={blueprintDescription}
onChange={handleDescriptionChange}
placeholder='Add description'
stepValidation={stepValidation}
fieldName='description'
handleClear={() => dispatch(changeBlueprintDescription(''))}
/>
</FormGroup>
</Form>
);
};
export default DetailsStep;