Skip to content

Commit e68c124

Browse files
authored
fix data props (#3)
1 parent ae66e73 commit e68c124

5 files changed

Lines changed: 16 additions & 24 deletions

File tree

.svgrrc.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ module.exports = {
44
template: require('./templates/svg.js'),
55
typescript: true,
66
outDir: path.join('src', 'icons'),
7+
expandProps: 'end',
78
memo: true,
89
icon: true,
910
svgProps: {
10-
className: '{className}',
11-
fill: 'currentColor',
12-
style: '{style}'
11+
fill: 'currentColor'
1312
}
1413
};

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,21 @@ function Component() {
3333
fontSize: '20px',
3434
color: 'red'
3535
}}
36-
// If you need to add extra props use
37-
svgProps={{}}
3836
// For icons that use strokeWidth you can change it like this
3937
strokeWidth={32}
4038
// to add a class name to the svg
4139
className="your class"
40+
// All the props are forwarded to the SVG component
4241
/>
4342
);
4443
}
4544
```
4645

47-
### Properties
46+
### Props
4847

49-
| Name | Type | Default |
50-
| ----------- | ------------- | -------- |
51-
| svgProps | SVGProps | {} |
52-
| style | CSSProperties | {} |
53-
| strokeWidth | number | 32 or 16 |
54-
| className | string | |
48+
| Name | Type | Default |
49+
| ----------- | ---------------- | -------- |
50+
| style | CSSProperties | {} |
51+
| strokeWidth | number \| string | 32 or 16 |
52+
| className | string | |
53+
| ... | Other SVG Props | |

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@raresail/react-ionicons",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"repository": "git@github.com:RaresAil/react-ionicons.git",
55
"author": "RaresAil <rares.ailincai@raresdesigns.com>",
66
"license": "MIT",

src/types.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

templates/svg.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ const propTypesTemplate = (
22
{ /* imports, */ interfaces, componentName, jsx, exports },
33
{ tpl }
44
) => {
5-
return tpl`import { memo } from 'react';
6-
import type { IonIconProps } from '../types';
5+
return tpl`import { SVGProps, memo } from 'react';
76
${interfaces}
87
9-
function ${componentName}({ className, strokeWidth, style, svgProps: props }: IonIconProps) {
8+
function ${componentName}({
9+
strokeWidth,
10+
...props
11+
}: Omit<SVGProps<SVGSVGElement>, 'fill' | 'stroke'>) {
1012
return ${jsx};
1113
}
1214

0 commit comments

Comments
 (0)