UNPKG

@omni-door/tpl-component-library-react

Version:
9 lines (8 loc) 1.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var utils_1 = require("@omni-door/utils"); var tpl = "`import React, { PureComponent } from 'react';\nimport propTypes from 'prop-types';\n${ts ? `import { ${componentName}Props, ${componentName}States } from './interface';` : ''}\n\nexport class ${componentName} extends PureComponent${ts ? `<${componentName}Props, ${componentName}States>` : ''} {\n /**\n * \u4F7F\u7528 prop-types \u662F\u4E3A\u4E86\u786E\u4FDD\u5373\u4FBF\u5BBF\u4E3B\u73AF\u5883\u6CA1\u6709\u4F7F\u7528 typescript \u4E5F\u4F9D\u7136\u80FD\u591F\u8FDB\u884C\u7C7B\u578B\u68C0\u67E5\n * prop-types can make sure the type-check whatever the environment whether or not use typescript\n */\n ${ts ? 'public ' : ''}static propTypes = {\n className: propTypes.string\n };\n\n ${ts ? 'public ' : ''}render() {\n const { children } = this.props;\n\n return (\n <div\n className='${componentName}'\n >\n { children }\n </div>\n );\n }\n}\n\nexport default ${componentName};\n`"; exports.tpl_new_class = { tpl: tpl }; exports.default = utils_1.tpl_engine_new(exports.tpl_new_class, 'tpl');