-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgridTextField.component.js
More file actions
37 lines (33 loc) · 968 Bytes
/
Copy pathgridTextField.component.js
File metadata and controls
37 lines (33 loc) · 968 Bytes
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
import React, { memo } from 'react';
import PropTypes from 'prop-types';
import Grid from '@material-ui/core/Grid';
import TextField from '@material-ui/core/TextField';
import { useInput } from '../hooks/useInput.hook';
export const GridTextField = memo(
({ initialState, props, gridProps, inputName, onBlur }) => {
const [value, onChange] = useInput(initialState);
return (
<Grid item {...gridProps}>
<TextField
required
id={inputName}
name={inputName}
onBlur={onBlur}
variant="standard"
fullWidth
{...props}
value={value}
onChange={onChange}
/>
</Grid>
);
},
);
GridTextField.displayName = 'GridTextField';
GridTextField.propTypes = {
props: PropTypes.object.isRequired,
gridProps: PropTypes.object.isRequired,
inputName: PropTypes.string.isRequired,
onBlur: PropTypes.func.isRequired,
initialState: PropTypes.any,
};