-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
feat(icons): add factory for creating svg icons #12319
Conversation
} | ||
}; | ||
|
||
const svgIconStyles: ComponentSlotStylesPrepared<SvgIconStylesProps, IconVariables> = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplified iconStyles that do not consider font icons and colors
packages/fluentui/docs/src/examples/components/Icon/Types/IconExample.shorthand.tsx
Outdated
Show resolved
Hide resolved
Perf AnalysisNo significant results to display. All results
Perf Analysis (Fluent)Perf comparison
Perf tests with no regressions
|
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: 898df7c6729e223b458fa5ab80813f6cad7da240 (build) |
size, | ||
xSpacing | ||
}), | ||
mapPropsToInlineStyles: () => ({ className, design, styles, variables }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mapPropsToInlineStyles: () => ({ className, design, styles, variables }), | |
mapPropsToInlineStyles: () => ({ className }), |
For now, let's keep compatibility with other components, but I think that these props (styles
, variables
) should be removed
<MenuItem icon={{ content: <BookIcon /> }} />
<MenuItem icon={<BookIcon />} /> Will |
export const SvgIconClassName = 'ui-icon'; | ||
export const SvgIconDisplayName = 'SvgIcon'; | ||
|
||
export const SvgIconHandledProps: (keyof SvgIconProps)[] = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const SvgIconHandledProps: (keyof SvgIconProps)[] = [ | |
const svgIconHandledProps: (keyof SvgIconProps)[] = [ |
I don't think that we need to export this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same is used in the SvgIcon
component, that's why we need to export it
packages/fluentui/react-bindings/test/icons/createSvgIcon-test.tsx
Outdated
Show resolved
Hide resolved
packages/fluentui/react-bindings/test/icons/createSvgIcon-test.tsx
Outdated
Show resolved
Hide resolved
packages/fluentui/react-bindings/test/icons/createSvgIcon-test.tsx
Outdated
Show resolved
Hide resolved
Co-Authored-By: Oleksandr Fediashov <alexander.mcgarret@gmail.com>
….tsx Co-Authored-By: Oleksandr Fediashov <alexander.mcgarret@gmail.com>
packages/fluentui/react-bindings/test/icons/createSvgIcon-test.tsx
Outdated
Show resolved
Hide resolved
….tsx Co-Authored-By: Oleksandr Fediashov <alexander.mcgarret@gmail.com>
This PR introduces
SvgIcon
utility component that can be used for creating SVG icons. The motitivation of this is mostly for reducing the bundle size. Currently all icons that we have (all svgs) are part of the gigantic theme object. With this factory, we are allowing the users to create themable component icons, without including the svgs inside the theme object.For this to work there are two ways of creating the icons.
SvgIcon
under the hood (this will result with two components inside the React tree)