You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
836 B
42 lines
836 B
import { Typography } from '@mui/material'; |
|
import { styled } from '@mui/material/styles'; |
|
import { TEXT, UNSELECTED } from '../../lib/consts/DEFAULT_THEME'; |
|
|
|
const PREFIX = 'BodyText'; |
|
|
|
const classes = { |
|
selected: `${PREFIX}-selected`, |
|
unselected: `${PREFIX}-unselected`, |
|
}; |
|
|
|
const StyledTypography = styled(Typography)(() => ({ |
|
[`&.${classes.selected}`]: { |
|
color: TEXT, |
|
}, |
|
|
|
[`&.${classes.unselected}`]: { |
|
color: UNSELECTED, |
|
}, |
|
})); |
|
|
|
interface TextProps { |
|
text: string; |
|
selected?: boolean; |
|
} |
|
|
|
const BodyText = ({ text, selected }: TextProps): JSX.Element => { |
|
return ( |
|
<StyledTypography |
|
variant="subtitle1" |
|
className={selected ? classes.selected : classes.unselected} |
|
> |
|
{text} |
|
</StyledTypography> |
|
); |
|
}; |
|
|
|
BodyText.defaultProps = { |
|
selected: true, |
|
}; |
|
|
|
export default BodyText;
|
|
|