Skip to content
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

[BD-46] refactor: corrected PropTypes #2960

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Button/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ Button.propTypes = {
variant: PropTypes.string,
/** An icon component to render.
* Example import of a Paragon icon component: `import { Check } from '@edx/paragon/icons';` */
iconBefore: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
iconBefore: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]),
/** An icon component to render.
* Example import of a Paragon icon component: `import { Check } from '@edx/paragon/icons';` */
iconAfter: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
iconAfter: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]),
};

Button.defaultProps = {
Expand Down
2 changes: 1 addition & 1 deletion src/Dropzone/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ Dropzone.propTypes = {
*/
validator: PropTypes.func,
/** A component to display initial state of the `Dropzone`. */
inputComponent: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
inputComponent: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]),
};

export default Dropzone;
2 changes: 1 addition & 1 deletion src/Icon/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Icon.propTypes = {
* An icon component to render.
* Example import of a Paragon icon component: `import { Check } from '@edx/paragon/icons';`
*/
src: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
src: PropTypes.oneOfType([PropTypes.element, PropTypes.elementType]),
/** HTML element attributes to pass through to the underlying svg element */
svgAttrs: PropTypes.shape({
'aria-label': PropTypes.string,
Expand Down
2 changes: 1 addition & 1 deletion src/IconButton/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ IconButton.propTypes = {
/** An icon component to render. Example import of a Paragon icon component:
* `import { Check } from '@edx/paragon/dist/icon';`
* */
src: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
src: PropTypes.oneOfType([PropTypes.element, PropTypes.elementType]),
/** Alt text for your icon. For best practice, avoid using alt text to describe
* the image in the `IconButton`. Instead, we recommend describing the function
* of the button. */
Expand Down
4 changes: 2 additions & 2 deletions src/Menu/MenuItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ MenuItem.propTypes = {
/** Specifies the base element */
as: PropTypes.elementType,
/** Specifies the jsx before the content of the ``MenuItem`` */
iconBefore: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
iconBefore: PropTypes.oneOfType([PropTypes.element, PropTypes.elementType]),
/** Specifies the jsx after the content of the ``MenuItem`` */
iconAfter: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
iconAfter: PropTypes.oneOfType([PropTypes.element, PropTypes.elementType]),
};

MenuItem.defaultProps = {
Expand Down
2 changes: 1 addition & 1 deletion src/Overlay/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ This component is used to power Tooltips and Popovers.
Click me to see
</Button>
</div>
<Overlay target={target.current} show={open} placement="right">
<Overlay target={target.current} show={isOpen} placement="right">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch :)

{({ placement, arrowProps, show: _show, popper, ...props }) => (
<div
{...props}
Expand Down
2 changes: 1 addition & 1 deletion src/Overlay/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Overlay.propTypes = {
* Animate the entering and exiting of the Overlay. `true` will use the `<Fade>` transition,
* or a custom react-transition-group `<Transition>` component can be provided.
*/
transition: PropTypes.func,
transition: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]),
};

OverlayTrigger.propTypes = {
Expand Down
8 changes: 6 additions & 2 deletions www/src/components/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export interface IComponentNavItem {
type: string,
status?: string,
},
isActive: boolean,
isActive?: boolean,
}

export function ComponentNavItem({
Expand Down Expand Up @@ -119,7 +119,11 @@ ComponentNavItem.propTypes = {
title: PropTypes.string.isRequired,
status: PropTypes.string,
}).isRequired,
isActive: PropTypes.bool.isRequired,
isActive: PropTypes.bool,
};

ComponentNavItem.defaultProps = {
isActive: false,
};

export type MenuComponentListTypes = {
Expand Down