UNPKG

@omni-door/tpl-ssr-react

Version:
10 lines (9 loc) 1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.tpl_src_component_link = void 0; var utils_1 = require("@omni-door/utils"); var tpl = "`import { memo } from 'react';\nimport { Link as NextLink } from 'next-url-prettifier';\nimport { nextRouter } from '../../routes';\n${ts ? `/* import types */\nimport type { FC, PropsWithChildren } from 'react';\n\nexport interface LinkProps {\n href?: string;\n page?: string;\n params?: { [props: string]: any; };\n children?: React.ReactNode;\n}\n` : '' }\nexport const Link${ts ? ': FC<PropsWithChildren<LinkProps>>' : ''} = props => {\n const { href, page, params = {}, children } = props;\n\n return (\n <NextLink\n href={href}\n route={ page ? nextRouter.linkPage(page, params) : null}\n >\n { children }\n </NextLink>\n );\n};\n\nexport default memo(Link);\n`"; exports.tpl_src_component_link = { tpl: tpl }; exports.default = utils_1.tplEngineInit(exports.tpl_src_component_link, 'tpl');