Skip to content

Commit

Permalink
refactor: corrected PropTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
PKulkoRaccoonGang committed Dec 21, 2023
1 parent b75b866 commit 97355d2
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 11 deletions.
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 @@ -72,7 +72,7 @@ function Icon({
Icon.propTypes = {
// eslint-disable-next-line max-len
/** 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]),
/** 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">
{({ 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 @@ -70,7 +70,7 @@ export interface IComponentNavItem {
type: string,
status?: string,
},
isActive: boolean,
isActive?: boolean,
}

export function ComponentNavItem({
Expand Down Expand Up @@ -114,7 +114,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

0 comments on commit 97355d2

Please sign in to comment.