-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
48 changed files
with
3,127 additions
and
1,455 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,47 @@ | ||
import React from 'react'; | ||
import { withStyles } from '@material-ui/styles'; | ||
import MuiButton from '@material-ui/core/Button'; | ||
import Box from '@material-ui/core/Box'; | ||
|
||
const Button = withStyles(() => ({ | ||
const ButtonSuccess = withStyles(() => ({ | ||
contained: { | ||
backgroundColor: '#007E3A', | ||
minWidth: '100%', | ||
backgroundColor: '#397F3A', | ||
textTransform: 'none', | ||
color: '#fff' | ||
} | ||
}))(MuiButton); | ||
|
||
export default ({ children, ...rest }) => ( | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
<Button variant="contained" {...rest}> | ||
{children} | ||
</Button> | ||
const ButtonSecondary = withStyles(theme => ({ | ||
contained: { | ||
minWidth: '100%', | ||
backgroundColor: theme.palette.secondary, | ||
color: '#000' | ||
}, | ||
root: { | ||
minWidth: '100%', | ||
textTransform: 'none', | ||
} | ||
}))(MuiButton); | ||
|
||
const ButtonPrimmary = withStyles(() => ({ | ||
contained: { | ||
minWidth: '100%', | ||
textTransform: 'none', | ||
backgroundColor: '#fff', | ||
color: '#000' | ||
} | ||
}))(MuiButton); | ||
|
||
export default ({ children, color, width, ...rest }) => ( | ||
<Box width={width}> | ||
{ | ||
{ | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
success: <ButtonSuccess {...rest}>{children}</ButtonSuccess>, | ||
secondary: <ButtonSecondary {...rest}>{children}</ButtonSecondary>, | ||
primmary: <ButtonPrimmary {...rest}>{children}</ButtonPrimmary> | ||
}[color] | ||
} | ||
</Box> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,22 @@ | ||
import React from 'react'; | ||
import { Box } from '@material-ui/core'; | ||
import { ErrorMessage } from 'react-hook-form'; | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
|
||
export default ({ children }) => ( | ||
<Box m={1}> | ||
<span style={{ color: 'red' }}>{children}</span> | ||
</Box> | ||
); | ||
const useStyles = makeStyles({ | ||
root: { | ||
color: '#bf1650' | ||
} | ||
}); | ||
|
||
export default ({ name, errors }) => { | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<Box m={1}> | ||
<ErrorMessage name={name} errors={errors}> | ||
{({ message }) => <p className={classes.root}>{message}</p>} | ||
</ErrorMessage>{' '} | ||
</Box> | ||
); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,47 @@ | ||
import React from 'react'; | ||
import { withStyles } from '@material-ui/core/styles'; | ||
import { Box, TextField } from '@material-ui/core'; | ||
import ErrorMessage from '../ErrorMsg'; | ||
import useWindowDimensions from '../../../core/hooks/useWindowDimensions'; | ||
|
||
export default ({ label, name, endAdornment, ...props }) => { | ||
const styles = { | ||
input: { | ||
minWidth: '100%', | ||
backgroundColor: 'transparent' | ||
} | ||
}; | ||
|
||
const CustomizedInputs = ({ | ||
classes, | ||
inputRef, | ||
label, | ||
name, | ||
errors, | ||
endAdornment, | ||
readOnly, | ||
...props | ||
}) => { | ||
const { width } = useWindowDimensions(); | ||
return ( | ||
<Box m={1}> | ||
<Box p={1} width={width - 32}> | ||
<TextField | ||
label={label} | ||
readOnly | ||
variant="outlined" | ||
style={{ width: '100%' }} | ||
autoComplete="off" | ||
name={name} | ||
inputRef={inputRef} | ||
InputProps={{ | ||
// eslint-disable-next-line react/destructuring-assignment | ||
...props.InputProps, | ||
endAdornment: endAdornment | ||
readOnly, | ||
className: classes.input, | ||
endAdornment | ||
}} | ||
{...props} | ||
/> | ||
<ErrorMessage name={name} errors={errors} /> | ||
</Box> | ||
); | ||
}; | ||
export default withStyles(styles)(CustomizedInputs); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React, { useEffect } from 'react'; | ||
import MenuItem from '@material-ui/core/MenuItem'; | ||
import uniqid from 'uniqid'; | ||
import Input from './Input'; | ||
|
||
export default ({ | ||
options, | ||
label, | ||
name, | ||
required, | ||
register, | ||
unregister, | ||
setValue, | ||
errors | ||
}) => { | ||
const [gender, setGender] = React.useState(''); | ||
|
||
const handleChange = event => { | ||
setGender(event.target.value); | ||
setValue(name, event.target.value); | ||
}; | ||
useEffect(() => { | ||
register({ name }, { required }); | ||
return () => unregister(name); // unregister input after component unmount | ||
}, [register]); | ||
|
||
return ( | ||
<Input | ||
errors={errors} | ||
variant="outlined" | ||
id="select" | ||
onChange={handleChange} | ||
label={label} | ||
value={gender} | ||
name={name} | ||
select | ||
> | ||
{options && | ||
options.map(item => ( | ||
<MenuItem key={uniqid()} value={item.value}> | ||
{item.name} | ||
</MenuItem> | ||
))} | ||
</Input> | ||
); | ||
}; |
Oops, something went wrong.