Skip to content

Width and height props added to Icon, passed only in case of svg icon #2583

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

Merged
merged 6 commits into from
Jun 13, 2023
Merged
Changes from 1 commit
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
12 changes: 12 additions & 0 deletions src/components/icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ export type IconProps = ImageProps &
* whether the icon should flip horizontally on RTL
*/
supportRTL?: boolean;
/**
* Width and height of the icon will be used only in case that the icon is svg image.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will only be shown in the width docs, maybe write something specific for each one?

*
* The icon width
*/
width?: string | number;
/**
* The icon height
*/
height?: string | number;
};

/**
Expand Down Expand Up @@ -77,6 +87,8 @@ const Icon = forwardRef((props: Props, ref: any) => {
return renderImage();
}

console.log(`isSvg(source)L`, isSvg(source));
Copy link
Collaborator

Choose a reason for hiding this comment

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

I assume this was added by mistake


return isSvg(source) ? renderSvg() : renderImage();
});

Expand Down