Skip to content

Commit

Permalink
Move helper function to end + remove unnecessary variable
Browse files Browse the repository at this point in the history
  • Loading branch information
albarv340 committed Nov 30, 2024
1 parent 762daf7 commit cf54828
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions packages/mui-material/src/ButtonBase/ButtonBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,6 @@ export const ButtonBaseRoot = styled('button', {
},
});

function useRippleHandler(ripple, rippleAction, eventCallback, skipRippleAction = false) {
return useEventCallback((event) => {
if (eventCallback) {
eventCallback(event);
}

const ignore = skipRippleAction;
if (!ignore) {
ripple[rippleAction](event);
}

return true;
});
}

/**
* `ButtonBase` contains as few styles as possible.
* It aims to be a simple building block for creating a button.
Expand Down Expand Up @@ -332,6 +317,20 @@ const ButtonBase = React.forwardRef(function ButtonBase(inProps, ref) {
);
});

function useRippleHandler(ripple, rippleAction, eventCallback, skipRippleAction = false) {
return useEventCallback((event) => {
if (eventCallback) {
eventCallback(event);
}

if (!skipRippleAction) {
ripple[rippleAction](event);
}

return true;
});
}

ButtonBase.propTypes /* remove-proptypes */ = {
// ┌────────────────────────────── Warning ──────────────────────────────┐
// │ These PropTypes are generated from the TypeScript type definitions. │
Expand Down

0 comments on commit cf54828

Please sign in to comment.