-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update style on the forms * git ignore cli * prettier linting
- Loading branch information
Showing
8 changed files
with
218 additions
and
122 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
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,72 @@ | ||
import { | ||
Grid, | ||
makeStyles, | ||
Typography, | ||
SvgIcon, | ||
Divider, | ||
Container, | ||
Tooltip, | ||
} from '@material-ui/core'; | ||
import React, { FC, ReactNode } from 'react'; | ||
import { HelpCircle } from 'react-feather'; | ||
import { Theme } from '../utils/theme'; | ||
|
||
const useStyles = makeStyles((theme: Theme) => ({ | ||
container: { | ||
padding: theme.spacing(2), | ||
}, | ||
innerContainer: { | ||
marginBottom: theme.spacing(1), | ||
}, | ||
labelGridItem: { | ||
width: '260px', | ||
paddingRight: theme.spacing(2), | ||
display: `flex`, | ||
flexFlow: `row wrap`, | ||
}, | ||
questionMark: { | ||
marginLeft: theme.spacing(1), | ||
}, | ||
})); | ||
|
||
type FieldWrapperProps = { | ||
label: string; | ||
description: string; | ||
children: ReactNode; | ||
}; | ||
|
||
const FieldWrapper: FC<FieldWrapperProps> = ({ | ||
label, | ||
description, | ||
children, | ||
}: FieldWrapperProps): JSX.Element => { | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<Container maxWidth={false} disableGutters className={classes.container}> | ||
<Grid container className={classes.innerContainer}> | ||
<Grid | ||
item | ||
xs={4} | ||
className={classes.labelGridItem} | ||
alignItems="flex-start" | ||
> | ||
<Typography variant="body1">{label}</Typography> | ||
<sub className={classes.questionMark}> | ||
<Tooltip title={description}> | ||
<SvgIcon color="primary"> | ||
<HelpCircle width="16px" height="16px" fontSize="1em" /> | ||
</SvgIcon> | ||
</Tooltip> | ||
</sub> | ||
</Grid> | ||
<Grid item xs alignItems="flex-start"> | ||
{children} | ||
</Grid> | ||
</Grid> | ||
<Divider /> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default FieldWrapper; |
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
Oops, something went wrong.