mirror of
https://github.com/Vikeo/LifeTrinket.git
synced 2025-11-11 21:56:25 +00:00
41 lines
762 B
JavaScript
41 lines
762 B
JavaScript
const propTypesTemplate = (
|
|
{ interfaces, componentName, props, jsx },
|
|
{ tpl }
|
|
) => {
|
|
const title = componentName.split('Svg')[1];
|
|
|
|
interfaces[0].body.body.push({
|
|
type: 'TSPropertySignature',
|
|
key: { type: 'Identifier', name: 'size' },
|
|
typeAnnotation: {
|
|
type: 'TSTypeAnnotation',
|
|
typeAnnotation: {
|
|
type: 'TSStringKeyword',
|
|
},
|
|
},
|
|
initializer: null,
|
|
optional: true,
|
|
});
|
|
|
|
return tpl`
|
|
import PropTypes from 'prop-types';
|
|
import { SVGProps } from "react";
|
|
|
|
${interfaces}
|
|
|
|
const ${title} = (${props}) => {
|
|
return ${jsx};
|
|
}
|
|
|
|
${title}.propTypes = {
|
|
title: PropTypes.string,
|
|
};
|
|
|
|
export default ${title}`;
|
|
};
|
|
|
|
|
|
// eslint-disable-next-line no-undef
|
|
module.exports = propTypesTemplate;
|
|
|