Merge pull request #20457 from backstage/rugvip/nosvgicon

cli: deprecate support for .icon.svg
This commit is contained in:
Patrik Oldsberg
2023-10-09 10:14:46 +02:00
committed by GitHub
20 changed files with 236 additions and 62 deletions
+30
View File
@@ -60,10 +60,40 @@ declare module '*.yaml' {
export default src;
}
/**
* @deprecated support for .icon.svg extensions are being removed, inline the SVG elements in a MUI SvgIcon instead.
* @example
* ```tsx
* import SvgIcon from '@material-ui/core/SvgIcon';
*
* const MyIcon = () => (
* <SvgIcon>
* <g>
* <path d="..." />
* </g>
* </SvgIcon>
* )
* ```
*/
declare module '*.icon.svg' {
import { ComponentType } from 'react';
import { SvgIconProps } from '@material-ui/core';
/**
* @deprecated support for .icon.svg extensions are being removed, inline the SVG elements in a MUI SvgIcon instead.
* @example
* ```tsx
* import SvgIcon from '@material-ui/core/SvgIcon';
*
* const MyIcon = () => (
* <SvgIcon>
* <g>
* <path d="..." />
* </g>
* </SvgIcon>
* )
* ```
*/
const Icon: ComponentType<SvgIconProps>;
export default Icon;
}
+2
View File
@@ -34,6 +34,8 @@ export function svgrTemplate(
${imports}
import SvgIcon from '@material-ui/core/SvgIcon';
console.log('DEPRECATION WARNING: The .icon.svg extension is deprecated, inline the SVG elements in a MUI SvgIcon instead.', Object.assign(new Error(), {name: 'Warning'}).stack);
${interfaces}
const ${name} = (${props}) => React.createElement(SvgIcon, ${props}, ${jsx.children});