Skip to content

Commit

Permalink
chore: replace mui system props with sx
Browse files Browse the repository at this point in the history
  • Loading branch information
marcustyphoon committed Sep 9, 2024
1 parent fe05034 commit 429d888
Show file tree
Hide file tree
Showing 25 changed files with 107 additions and 84 deletions.
2 changes: 1 addition & 1 deletion src/components/BuildPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const BuildPage = () => {
// eslint-disable-next-line react/no-unstable-nested-components
function Traits({ id, selected: selectedTraits }) {
return (
<Box display="flex" mb={1}>
<Box sx={{ display: 'flex', mb: 1 }}>
<Paper elevation={0} className={classes.traitlineRoot}>
<Typography variant="body1" className={classes.traitlineText}>
{traitLookup[id]}
Expand Down
6 changes: 3 additions & 3 deletions src/components/GearOptimizer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const GearOptimizer = () => {
<NavBar />
<Box>
{profession === '' && (
<Typography mb={1}>
<Typography sx={{ mb: 1 }}>
<ExpandLessIcon />
<i>{expertMode ? classOrBuildText : classText}</i> <ExpandLessIcon />
</Typography>
Expand Down Expand Up @@ -95,9 +95,9 @@ const GearOptimizer = () => {
<Controls />

<ResultTable />
<Box m={3} />
<Box sx={{ m: 3 }} />
<ResultDetails />
<Box m={3} />
<Box sx={{ m: 3 }} />

<SharingSection />
</div>
Expand Down
20 changes: 11 additions & 9 deletions src/components/baseComponents/CircularProgressWithLabel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ import Typography from '@mui/material/Typography';
function CircularProgressWithLabel(props) {
const { value } = props;
return (
<Box position="relative" display="inline-flex">
<Box sx={{ position: 'relative', display: 'inline-flex' }}>
<CircularProgress variant="determinate" {...props} />
<Box
top={0}
left={0}
bottom={0}
right={0}
position="absolute"
display="flex"
alignItems="center"
justifyContent="center"
sx={{
top: 0,
left: 0,
bottom: 0,
right: 0,
position: 'absolute',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
<Typography variant="caption" color="textSecondary">{`${Math.round(value)}%`}</Typography>
</Box>
Expand Down
2 changes: 1 addition & 1 deletion src/components/baseComponents/Layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Box, Container } from '@mui/material';

const Layout = ({ children, ContainerProps, disableContainer = false }) =>
disableContainer ? (
<Box p={2}>{children}</Box>
<Box sx={{ p: 2 }}>{children}</Box>
) : (
<Container disableGutters maxWidth="lg" {...ContainerProps}>
<Box
Expand Down
2 changes: 1 addition & 1 deletion src/components/baseComponents/Section.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const SectionInfo = ({ title, children }) => {
// first disables the delimiting line above!
const Section = ({ first, title, helpText, extraInfo, content }) => {
return (
<Grid item container spacing={2} mb={2} sx={{ borderColor: 'primary.main' }}>
<Grid item container spacing={2} sx={{ mb: 2, borderColor: 'primary.main' }}>
{!first && (
<Grid item xs={12}>
<Divider />
Expand Down
2 changes: 1 addition & 1 deletion src/components/nav/NavAccordion.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default function NavAccordion({ handleTemplateSelect }) {
</MuiAccordionSummary>
<MuiAccordionDetails classes={{ root: classes.accordionDetailsRoot }}>
{prof.builds.map((build) => (
<Box mb={1} key={`templateBuildMobile_${build.name}`}>
<Box key={`templateBuildMobile_${build.name}`} sx={{ mb: 1 }}>
<Chip
variant="outlined"
label={<Profession name={build.specialization} text={build.name} disableLink />}
Expand Down
10 changes: 5 additions & 5 deletions src/components/nav/NavBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ const Navbar = () => {

const stickyRight = () => {
return (
<Box display="flex" alignItems="center" gap={1}>
<Box display="flex" flexDirection="column" alignItems="center">
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
<Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
<Tooltip content={`${t('Selected Game Mode')}: ${selectedGameModeText}`}>
<IconButton size="small" onClick={handleModeCycle}>
<img style={{ width: '40px' }} src={gameModeImage} alt={selectedGameModeText} />
Expand Down Expand Up @@ -151,7 +151,7 @@ const Navbar = () => {

return (
<Toolbar>
<Box flexGrow={1}>
<Box sx={{ flexGrow: 1 }}>
<IconButton
{...{
edge: 'start',
Expand Down Expand Up @@ -219,7 +219,7 @@ const Navbar = () => {
];
const displayDesktop = () => (
<Toolbar>
<Box flexGrow={1}>
<Box sx={{ flexGrow: 1 }}>
{PROFESSIONS.map((prof, index) => (
<React.Fragment key={prof}>
<Button
Expand Down Expand Up @@ -272,7 +272,7 @@ const Navbar = () => {
</Box>

{showSelectedTemplate && (selectedSpecialization || selectedTemplateName) && (
<Box flexGrow={1}>
<Box sx={{ flexGrow: 1 }}>
<Typography>
<Trans>Selected</Trans>:{' '}
</Typography>
Expand Down
8 changes: 4 additions & 4 deletions src/components/sections/affixes/Affixes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function Affixes() {
return (
<Stack spacing={7}>
<Box>
<Typography fontWeight={700} mb={0.5}>
<Typography sx={{ fontWeight: 700, mb: 0.5 }}>
{t('Desired Affixes')}{' '}
<HelperIcon
text={t(
Expand All @@ -47,7 +47,7 @@ export default function Affixes() {
</Box>
{exclusionsEnabled && (
<Box>
<Typography fontWeight={700} mb={0.5}>
<Typography sx={{ fontWeight: 700, mb: 0.5 }}>
{t('Per-Slot Exclusions')}{' '}
<HelperIcon
text={t(
Expand All @@ -61,7 +61,7 @@ export default function Affixes() {
)}
{exoticsEnabled && (
<Box>
<Typography fontWeight={700} mb={0.5}>
<Typography sx={{ fontWeight: 700, mb: 0.5 }}>
{t('Use exotic rarity')}{' '}
<HelperIcon
text={t('Allows you to use exotic rarity instead of ascended for any gear slot.')}
Expand All @@ -86,7 +86,7 @@ export default function Affixes() {
)}
{customSelected && (
<Box>
<Typography fontWeight={700}>
<Typography sx={{ fontWeight: 700 }}>
{t('Custom Affix Data')}{' '}
<HelperIcon
text={t('Specify any attributes to simulate with the "custom" affix type.')}
Expand Down
30 changes: 18 additions & 12 deletions src/components/sections/boss/Boss.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const Boss = () => {

return (
<>
<Box display="flex" flexWrap="wrap">
<Box sx={{ display: 'flex', flexWrap: 'wrap' }}>
<Box sx={{ width: 195 }}>
<AmountInput
label={
Expand All @@ -93,11 +93,14 @@ const Boss = () => {
/>
</Box>
<Box
mx={3}
mb={4}
flexGrow={1}
alignSelf="center"
sx={{ minWidth: 200, md: { marginLeft: 2 } }}
sx={{
mx: 3,
mb: 4,
flexGrow: 1,
alignSelf: 'center',
minWidth: 200,
md: { marginLeft: 2 },
}}
>
<Slider
value={movementUptime}
Expand All @@ -111,7 +114,7 @@ const Boss = () => {
/>
</Box>
</Box>
<Box display="flex" flexWrap="wrap">
<Box sx={{ display: 'flex', flexWrap: 'wrap' }}>
<Box sx={{ width: 195 }}>
<AmountInput
label={
Expand All @@ -133,11 +136,14 @@ const Boss = () => {
/>
</Box>
<Box
mx={3}
mb={4}
flexGrow={1}
alignSelf="center"
sx={{ minWidth: 200, md: { marginLeft: 2 } }}
sx={{
mx: 3,
mb: 4,
flexGrow: 1,
alignSelf: 'center',
minWidth: 200,
md: { marginLeft: 2 },
}}
>
<Slider
value={attackRate}
Expand Down
6 changes: 3 additions & 3 deletions src/components/sections/buffs/Buffs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ const Buffs = () => {
);

return (
<Box justifyContent="space-between" display="flex" key={id}>
<Box display="flex">
<Box key={id} sx={{ justifyContent: 'space-between', display: 'flex' }}>
<Box sx={{ display: 'flex' }}>
<CheckboxComponent
key={id}
value={id}
Expand All @@ -110,7 +110,7 @@ const Buffs = () => {
/>
</Box>
{amountData ? (
<Box display="flex">
<Box sx={{ display: 'flex' }}>
<AmountInput
placeholder={amountData.default}
endLabel={amountData.label}
Expand Down
8 changes: 4 additions & 4 deletions src/components/sections/controls/Controls.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const ControlsBox = () => {
}

return (
<Box display="flex" flexWrap="wrap">
<Box sx={{ display: 'flex', flexWrap: 'wrap' }}>
<Box>
<Button
variant="outlined"
Expand Down Expand Up @@ -147,7 +147,7 @@ const ControlsBox = () => {
</Typography>
</Button>
</Box>
<Box flexGrow={1}>
<Box sx={{ flexGrow: 1 }}>
{status === STOPPED ? (
<Button
variant="outlined"
Expand All @@ -163,12 +163,12 @@ const ControlsBox = () => {
) : null}
</Box>

<Box alignSelf="center" display="flex" m={1} maxWidth={300}>
<Box sx={{ alignSelf: 'center', display: 'flex', m: 1, maxWidth: 300 }}>
<Typography variant="caption" className={classes.errorText}>
{error}
</Typography>
</Box>
<Box alignSelf="center">
<Box sx={{ alignSelf: 'center' }}>
<Chip
sx={{ marginRight: 1 }}
label={
Expand Down
15 changes: 9 additions & 6 deletions src/components/sections/distribution/DamageDistribution.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const DamageDistribution = () => {
if (!alternativeDamageEnabled) style = { opacity: 0.5 };
}
return (
<Box display="flex" flexWrap="wrap" key={`distriNew_${dist.name}`} style={style}>
<Box key={`distriNew_${dist.name}`} style={style} sx={{ display: 'flex', flexWrap: 'wrap' }}>
<Box>
<FormControl mb={1} className={classes.textbox} variant="standard">
<InputLabel htmlFor={`input-with-icon-adornment-${index}`}>
Expand Down Expand Up @@ -118,11 +118,14 @@ const DamageDistribution = () => {
</FormControl>
</Box>
<Box
flexGrow={1}
alignSelf="center"
mx={3}
mb={4}
sx={{ minWidth: 200, md: { marginLeft: 2 } }}
sx={{
flexGrow: 1,
alignSelf: 'center',
mx: 3,
mb: 4,
minWidth: 200,
md: { marginLeft: 2 },
}}
>
<Slider
value={distributionNew[dist.name]}
Expand Down
10 changes: 5 additions & 5 deletions src/components/sections/extras/ExtraSelection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ export default function ExtraSelection(props) {

return (
<APILanguageProvider value={extrasOverrideLanguage}>
<Box display="flex" alignItems="flex-end" mb={1}>
<Typography component="span" flexGrow={1}>
<Box sx={{ display: 'flex', alignItems: 'flex-end', mb: 1 }}>
<Typography component="span" sx={{ flexGrow: 1 }}>
{label}
</Typography>
<Button variant="contained" size="small" startIcon={<AddIcon />} onClick={handleOpen}>
Expand All @@ -189,7 +189,7 @@ export default function ExtraSelection(props) {
>
<ListItemText
primary={
<Box display="flex">
<Box sx={{ display: 'flex' }}>
<Box>
{displayIds ? (
joinWith(
Expand Down Expand Up @@ -234,7 +234,7 @@ export default function ExtraSelection(props) {
</Typography>
)}

<Box flexGrow={1} />
<Box sx={{ flexGrow: 1 }} />
{amountData && (
<AmountInput
placeholder={amountData.default}
Expand Down Expand Up @@ -269,7 +269,7 @@ export default function ExtraSelection(props) {
PaperProps={{ elevation: 4 }}
>
<DialogTitle id="scroll-dialog-title" display="flex">
<Typography flexGrow={1} component="span" alignSelf="center">
<Typography component="span" sx={{ flexGrow: 1, alignSelf: 'center' }}>
{label}
</Typography>
<IconButton edge="start" color="inherit" onClick={handleClose} aria-label="close">
Expand Down
4 changes: 2 additions & 2 deletions src/components/sections/extras/ModalContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ function ModalContent(props) {
),
}}
/>
<Box display="flex">
<Box flexGrow={1} />
<Box sx={{ display: 'flex' }}>
<Box sx={{ flexGrow: 1 }} />
<Button
sx={{ textTransform: 'unset' }}
startIcon={<SelectAllIcon />}
Expand Down
7 changes: 6 additions & 1 deletion src/components/sections/forcedslots/ForcedSlots.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ const ForcedSlots = () => {
};

return (
<Grid container direction="row" justifyContent="flex-start" alignItems="flex-start" spacing={1}>
<Grid
container
direction="row"
spacing={1}
sx={{ justifyContent: 'flex-start', alignItems: 'flex-start' }}
>
{SLOTS.map((slot, index) => (
// eslint-disable-next-line react/no-array-index-key
<Grid item xs={6} sm={4} md={2} key={index}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/sections/infusions/InfusionHelper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ const InfusionHelper = () => {
}
onChange={(e) => dispatch(changeSingularity(e.target.checked))}
/>
<Box mb={2}>
<Box sx={{ mb: 2 }}>
<CheckboxComponent
value={tear}
checked={tear}
Expand Down Expand Up @@ -265,7 +265,7 @@ const InfusionHelper = () => {
onChange={handleSlotsChange}
aria-labelledby="total-infusion-slots"
/>
<Box mb={2}>
<Box sx={{ mb: 2 }}>
<CheckboxComponent
value={freeWvW}
checked={freeWvW}
Expand Down
Loading

0 comments on commit 429d888

Please sign in to comment.