UNPKG

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

Version:
9 lines (8 loc) 1.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var utils_1 = require("@omni-door/utils"); var tpl = "`import React, { memo${ts ? ', FC ' : ''}} from 'react';\nimport propTypes from 'prop-types';\n${ts ? `import { ${componentName}Props } from './interface';` : ''}\n\nexport const ${componentName}${ts ? `: FC<${componentName}Props>` : ''} = props => {\n const { children } = props;\n\n return (\n <div\n className='${componentName}'\n >\n { children }\n </div>\n );\n};\n\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${componentName}.propTypes = {\n className: propTypes.string\n};\n\nexport default memo(${componentName});\n`"; exports.tpl_new_functional = { tpl: tpl }; exports.default = utils_1.tpl_engine_new(exports.tpl_new_functional, 'tpl');