UNPKG

@omni-door/tpl-spa-react

Version:

The React single-page-application project template

10 lines (9 loc) 993 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.tpl_src_component_cp = void 0; var utils_1 = require("@omni-door/utils"); var tpl = "`import React from 'react';\nimport { useParams } from 'react-router-dom';\n${style ? `import './style/${componentName}.${style === 'all' ? 'scss' : style}';` : ''}\n${ts ? `/* import types */\nimport type { FC, PropsWithChildren } from 'react';\nimport type { PageProps } from '@/@types';\n\nexport interface ${componentName}Props extends PageProps {}\n` : '' }\nexport const ${componentName}${ts ? `: FC<PropsWithChildren<DetailProps>> ` : ''}= props => {\n const params = useParams${ts ? '<{ id: string }>()' : '()'};\n\n return (\n <div\n className='${componentName}'\n >\n { \\`params is: \\${params?.id}\\` }\n </div>\n );\n};\n\nexport default ${componentName};\n`"; exports.tpl_src_component_cp = { tpl: tpl }; exports.default = utils_1.tplEngineInit(exports.tpl_src_component_cp, 'tpl');