forked from redhat-developer/vscode-openshift-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomponentNameInput.tsx
More file actions
32 lines (30 loc) · 1.25 KB
/
componentNameInput.tsx
File metadata and controls
32 lines (30 loc) · 1.25 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
/*-----------------------------------------------------------------------------------------------
* Copyright (c) Red Hat, Inc. All rights reserved.
* Licensed under the MIT License. See LICENSE file in the project root for license information.
*-----------------------------------------------------------------------------------------------*/
import { TextField } from '@mui/material';
import * as React from 'react';
export type ComponentNameInputProps = {
isComponentNameFieldValid: boolean,
componentNameErrorMessage: string,
componentName: string,
setComponentName: React.Dispatch<React.SetStateAction<string>>
};
export function ComponentNameInput(props: ComponentNameInputProps) {
return (
<TextField fullWidth
id='componentName'
variant='outlined'
label='Component Name'
value={props.componentName}
error={!props.isComponentNameFieldValid}
helperText={props.componentNameErrorMessage}
onChange={(e) => {
window.vscodeApi.postMessage({
action: 'validateComponentName',
data: e.target.value
});
props.setComponentName(e.target.value);
}} />
);
}