Skip to content

Commit

Permalink
chore: remove propTypes extension as a PR is pending in @material/ui
Browse files Browse the repository at this point in the history
  • Loading branch information
paales committed Jan 18, 2022
1 parent f35cd32 commit 2bbb1cf
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions packages/next-ui/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,5 @@
/* eslint-disable react/forbid-foreign-prop-types */
import { LoadingButton as Button, LoadingButtonProps } from '@mui/lab'
import PropTypes, { Requireable } from 'prop-types'

/**
* This is temporary until Material UI solves that the variant proptype is not:
*
* ```ts
* variant: PropTypes.oneOf(['contained', 'outlined', 'text'])
* ```
*
* It should be something like
*
* ```ts
* variant: PropTypes.oneOfType([
* PropTypes.oneOf(['contained', 'outlined', 'text']),
* PropTypes.string,
* ]),
* ```
*
* https://github.com/mui-org/material-ui/blob/master/packages/mui-lab/src/LoadingButton/LoadingButton.js#L269
*/
type LoadingButtonPropTypes = typeof Button & { propTypes: Record<string, Requireable<any>> }
if (process.env.NODE_ENV !== 'production' && (Button as LoadingButtonPropTypes).propTypes) {
;(Button as LoadingButtonPropTypes).propTypes.variant = PropTypes.oneOfType([
(Button as LoadingButtonPropTypes).propTypes.variant,
PropTypes.string,
])
}

export type ButtonProps = LoadingButtonProps
export { Button }

0 comments on commit 2bbb1cf

Please sign in to comment.