Skip to content

Commit

Permalink
[Grid2] Add removal zeroMinWidth prop to codemod (#44178)
Browse files Browse the repository at this point in the history
  • Loading branch information
sai6855 authored Oct 22, 2024
1 parent 1c7f61f commit 5bb5a98
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/mui-codemod/src/v6.0.0/grid-v2-props/grid-v2-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,16 @@ export default function gridV2Props(file, api, options) {
(attr) => attr.type === 'JSXAttribute' && attr.name.name !== 'item',
);
}

const zeroMinWidthProp = el.node.openingElement.attributes.find(
(attr) => attr.type === 'JSXAttribute' && attr.name.name === 'zeroMinWidth',
);

if (zeroMinWidthProp) {
el.node.openingElement.attributes = el.node.openingElement.attributes.filter(
(attr) => attr.type === 'JSXAttribute' && attr.name.name !== 'zeroMinWidth',
);
}
});

return root.toSource(printOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ import { Grid as GridF } from '@mui/joy';
<GridA item={true} />;
<GridA item={false} />;

<GridA zeroMinWidth />;
<GridA zeroMinWidth={true} />;
<GridA zeroMinWidth={false} />;

// Transforms responsive sizes
<GridA xs={2} sm={4} md={6} lg={8} xl={10} />;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ import { Grid as GridF } from '@mui/joy';
<GridA />;
<GridA />;

<GridA />;
<GridA />;
<GridA />;

// Transforms responsive sizes
<GridA
size={{
Expand Down

0 comments on commit 5bb5a98

Please sign in to comment.