Allow 'styleName' for SVG elements via react module augment (#16004)

This commit is contained in:
Mark Crawshaw
2017-04-27 09:50:26 -07:00
committed by Sheetal Nandi
parent df38f202a0
commit e44c291ab7
2 changed files with 24 additions and 1 deletions
+4 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for react-css-modules 3.7.9
// Type definitions for react-css-modules 4.2.0
// Project: https://github.com/gajus/react-css-modules
// Definitions by: Kostya Esmukov <https://github.com/KostyaEsmukov>, Tadas Dailyda <https://github.com/skirsdeda>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -33,4 +33,7 @@ declare module 'react' {
interface HTMLAttributes<T> {
styleName?: string;
}
interface SVGAttributes<T> {
styleName?: string;
}
}
@@ -41,3 +41,23 @@ class TableDecorated extends React.Component<TableDecoratedProps, {}> {
</div>;
}
}
interface TableProps extends CSSModules.InjectedCSSModuleProps {
}
class Svg extends React.Component<TableProps, {}> {
render () {
const { styles } = this.props;
return <svg styleName='table'>
<g styleName='row'>
<rect styleName='cell' />
<rect styleName='cell' />
</g>
</svg>;
}
}
const SvgHOC = CSSModules(Svg, styles);