parent
93d10e0528
commit
427588df0f
2 changed files with 29 additions and 7 deletions
@ -1,15 +1,36 @@ |
|||||||
import { Typography } from '@material-ui/core'; |
import { Typography } from '@material-ui/core'; |
||||||
import { withStyles } from '@material-ui/core/styles'; |
import { makeStyles } from '@material-ui/core/styles'; |
||||||
import { TEXT } from '../../lib/consts/DEFAULT_THEME'; |
import { TEXT, UNSELECTED } from '../../lib/consts/DEFAULT_THEME'; |
||||||
|
|
||||||
const WhiteTypography = withStyles({ |
interface TextProps { |
||||||
root: { |
text: string; |
||||||
|
selected?: boolean; |
||||||
|
} |
||||||
|
|
||||||
|
const useStyles = makeStyles(() => ({ |
||||||
|
selected: { |
||||||
color: TEXT, |
color: TEXT, |
||||||
}, |
}, |
||||||
})(Typography); |
unselected: { |
||||||
|
color: UNSELECTED, |
||||||
|
}, |
||||||
|
})); |
||||||
|
|
||||||
|
const BodyText = ({ text, selected }: TextProps): JSX.Element => { |
||||||
|
const classes = useStyles(); |
||||||
|
|
||||||
|
return ( |
||||||
|
<Typography |
||||||
|
variant="subtitle1" |
||||||
|
className={selected ? classes.selected : classes.unselected} |
||||||
|
> |
||||||
|
{text} |
||||||
|
</Typography> |
||||||
|
); |
||||||
|
}; |
||||||
|
|
||||||
const BodyText = ({ text }: { text: string }): JSX.Element => { |
BodyText.defaultProps = { |
||||||
return <WhiteTypography variant="subtitle1">{text}</WhiteTypography>; |
selected: true, |
||||||
}; |
}; |
||||||
|
|
||||||
export default BodyText; |
export default BodyText; |
||||||
|
Loading…
Reference in new issue