Skip to content

Commit

Permalink
Fix framer types
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed May 12, 2021
1 parent 95cef8e commit c676f78
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
4 changes: 1 addition & 3 deletions framer/Material-UI.framerfx/code/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ interface Props extends SvgIconProps {

export function Icon(props: Props): JSX.Element | null {
const { height, icon: iconProp, theme, width, ...other } = props;
const iconName = `${iconProp && pascalCase(iconProp)}${
theme === 'Filled' ? '' : theme
}` as keyof typeof Icons;
const iconName = `${iconProp && pascalCase(iconProp)}${theme === 'Filled' ? '' : theme}`;
const MuiIcon = Object.keys(Icons).indexOf(iconName) !== -1 ? Icons[iconName] : undefined;

return MuiIcon ? <MuiIcon style={{ width, height }} {...other} /> : null;
Expand Down
4 changes: 1 addition & 3 deletions framer/scripts/templates/icon.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ interface Props extends SvgIconProps {

export function «componentName»(props: Props): JSX.Element | null {
const { height, icon: iconProp, theme, width, ...other } = props;
const iconName = `${iconProp && pascalCase(iconProp)}${
theme === 'Filled' ? '' : theme
}` as keyof typeof Icons;
const iconName = `${iconProp && pascalCase(iconProp)}${theme === 'Filled' ? '' : theme}`;
const MuiIcon = Object.keys(Icons).indexOf(iconName) !== -1 ? Icons[iconName] : undefined;

return MuiIcon ? <MuiIcon style={{ width, height}} {...other} /> : null;
Expand Down
2 changes: 1 addition & 1 deletion framer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"skipLibCheck": true,
"noUnusedLocals": true
},
"include": ["Material-UI.framerfx/code"]
"include": ["Material-UI.framerfx/code", "types"]
}
2 changes: 2 additions & 0 deletions framer/types/icons.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare module '@material-ui/icons';
declare module '@material-ui/icons/*';

0 comments on commit c676f78

Please sign in to comment.