Skip to content

Commit

Permalink
fix(Icon): remove defaultProps in favour of default values
Browse files Browse the repository at this point in the history
This was causing a warning in repositories with React version >= 18.3 since
defaultProps will be removed from function components in a future major
release (we could indeed check whether it is the case in React 19).

Slack: https://skypicker.slack.com/archives/C7T7QG7M5/p1719574765630519
  • Loading branch information
RobinCsl committed Jun 28, 2024
1 parent b202a36 commit 4448925
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions packages/orbit-components/src/Icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,18 @@ export const iconColorClasses: Record<ICON_COLORS, string> = {
[ICON_COLORS.CRITICAL]: "text-icon-critical-foreground",
};

const OrbitIcon = (props: FactoryProps) => {
const {
size = ICON_SIZES.MEDIUM,
color,
customColor,
className,
children,
viewBox,
dataTest,
ariaHidden,
reverseOnRtl,
ariaLabel,
} = props;
const OrbitIcon = ({
size = ICON_SIZES.MEDIUM,
color,
customColor,
className,
children,
viewBox,
dataTest,
ariaHidden,
reverseOnRtl,
ariaLabel,
}: FactoryProps) => {
return (
<svg
className={cx(
Expand All @@ -64,8 +63,4 @@ const OrbitIcon = (props: FactoryProps) => {
);
};

OrbitIcon.defaultProps = {
size: ICON_SIZES.MEDIUM,
};

export default OrbitIcon;

0 comments on commit 4448925

Please sign in to comment.