Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate 'Note' component away from makeStyles + cleanup #630

Merged
merged 7 commits into from
Apr 11, 2023
13 changes: 5 additions & 8 deletions packages/react-ui/src/widgets/legend/Note.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import { Box } from '@mui/material';
import makeStyles from '@mui/styles/makeStyles';
import { styled } from '@mui/material/styles';
import React from 'react';
import Typography from '../../components/atoms/Typography';

const useNoteStyles = makeStyles(() => ({
note: {
fontWeight: 'normal'
}
const FontWeightNormalTypography = styled(Typography)(({ theme }) => ({
fontWeight: 'normal'
}));

export default function Note({ children }) {
const classes = useNoteStyles();

if (!children) {
return null;
Expand All @@ -19,9 +16,9 @@ export default function Note({ children }) {
return (
<Box mt={1} data-testid='note-legend'>
<Typography variant='caption'>Note:</Typography>{' '}
<Typography className={classes.note} variant='caption'>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer necessary, as the caption variant has a regular weight by default.

You can use just <Typography variant='caption' /> and remove the customization.

<FontWeightNormalTypography variant='caption'>
{children}
</Typography>
</FontWeightNormalTypography>
</Box>
);
}