-
Notifications
You must be signed in to change notification settings - Fork 367
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
refactor: [M3-6300] - MUI v5 Migration - Components > CheckoutBar
#9051
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
import * as React from 'react'; | ||
import Typography from 'src/components/core/Typography'; | ||
import useStyles from './styles'; | ||
import { StyledCheckoutSection, SxTypography } from './styles'; | ||
|
||
export interface Props { | ||
export interface DisplaySectionProps { | ||
title: string; | ||
details?: string | number; | ||
} | ||
|
||
export const DisplaySection: React.FC<Props> = (props) => { | ||
const DisplaySection = React.memo((props: DisplaySectionProps) => { | ||
const { title, details } = props; | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<div className={classes.checkoutSection}> | ||
<StyledCheckoutSection> | ||
{title && ( | ||
<Typography variant="h3" data-qa-subheading={title}> | ||
{title} | ||
</Typography> | ||
)} | ||
{details && ( | ||
{details ? ( | ||
<Typography | ||
component="span" | ||
data-qa-details={details} | ||
className={classes.detail} | ||
sx={SxTypography} | ||
> | ||
{details} | ||
</Typography> | ||
)} | ||
</div> | ||
) : null} | ||
</StyledCheckoutSection> | ||
); | ||
}; | ||
}); | ||
|
||
export default React.memo(DisplaySection); | ||
export { DisplaySection }; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
import { makeStyles } from '@mui/styles'; | ||
import { Theme } from '@mui/material/styles'; | ||
import { useTheme } from '@mui/material/styles'; | ||
import { styled } from '@mui/system'; | ||
import Button from 'src/components/Button'; | ||
|
||
export const useStyles = makeStyles((theme: Theme) => ({ | ||
'@keyframes fadeIn': { | ||
from: { | ||
opacity: 0, | ||
}, | ||
to: { | ||
opacity: 1, | ||
}, | ||
const StyledButton = styled(Button)(({ theme }) => ({ | ||
marginTop: 18, | ||
[theme.breakpoints.up('lg')]: { | ||
width: '100%', | ||
}, | ||
root: { | ||
})); | ||
|
||
const StyledRoot = styled('div')(() => { | ||
const theme = useTheme(); | ||
|
||
return { | ||
minHeight: '24px', | ||
minWidth: '24px', | ||
[theme.breakpoints.down('md')]: { | ||
|
@@ -20,42 +22,29 @@ export const useStyles = makeStyles((theme: Theme) => ({ | |
left: '0 !important' as '0', | ||
bottom: '0 !important' as '0', | ||
}, | ||
}, | ||
sidebarTitle: { | ||
color: theme.color.headline, | ||
fontSize: '1.125rem', | ||
wordBreak: 'break-word', | ||
}, | ||
checkoutSection: { | ||
animation: '$fadeIn 225ms linear forwards', | ||
opacity: 0, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It wasn't clear to me if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not totally sure either, but it seems like the "Create Cluster" button does a slight fade in when the component first loads in prod. I don't think this is necessary and initial rendering + interacting with the CheckoutBar looks smooth to me without any animation |
||
padding: '12px 0', | ||
[theme.breakpoints.down('md')]: { | ||
'& button': { | ||
marginLeft: 0, | ||
}, | ||
}, | ||
[theme.breakpoints.down('lg')]: { | ||
paddingBottom: `0px !important`, | ||
}; | ||
}); | ||
|
||
const StyledCheckoutSection = styled('div')(({ theme }) => ({ | ||
padding: '12px 0', | ||
[theme.breakpoints.down('md')]: { | ||
'& button': { | ||
marginLeft: 0, | ||
}, | ||
}, | ||
price: { | ||
color: theme.color.headline, | ||
fontSize: '.8rem', | ||
lineHeight: '1.5em', | ||
marginTop: theme.spacing(), | ||
[theme.breakpoints.down('lg')]: { | ||
paddingBottom: `0px !important`, | ||
}, | ||
detail: { | ||
})); | ||
|
||
const SxTypography = () => { | ||
const theme = useTheme(); | ||
|
||
return { | ||
color: theme.color.headline, | ||
fontSize: '.8rem', | ||
lineHeight: '1.5em', | ||
}, | ||
createButton: { | ||
marginTop: 18, | ||
[theme.breakpoints.up('lg')]: { | ||
width: '100%', | ||
}, | ||
}, | ||
})); | ||
}; | ||
}; | ||
|
||
export default useStyles; | ||
export { StyledButton, StyledRoot, StyledCheckoutSection, SxTypography }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
details
is typed as a string or number, so I went with the ternary here.