UNPKG

@omni-door/tpl-ssr-react

Version:
10 lines (9 loc) 2.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.tpl_src_component_layout = void 0; var utils_1 = require("@omni-door/utils"); var tpl = "`import { memo } from 'react';\nimport Head from 'next/head';\nimport Link from '${serverType === 'koa-next' ? '@components/Link' : 'next/link'}';\n${style ? `import styles from './style/Layout.module.${style === 'all' ? 'scss' : style}';` : ''}\n${ts ? `/* import types */\nimport type { FC, PropsWithChildren } from 'react';\n\nexport interface LayoutProps {\n title?: string;\n className?: string;\n page?: string;\n children?: any\n}\n` : '' }\nexport const Layout${ts ? ': FC<PropsWithChildren<LayoutProps>>' : ''} = props => {\n const { title = 'OMNI-DOOR', className = '', page = 'home', children } = props;\n\n return (\n <main\n className={${style ? \"[styles['layout'], className].join(' ')\" : \"'layout'\"}}\n >\n <Head>\n <title>{ title }</title>\n <link rel='icon' type='image/x-icon' href='/favicon.ico' />\n </Head>\n <header className={${style ? \"styles['layout-header']\" : \"'layout-header'\"}}>\n <nav className={${style ? \"styles['layout-header-nav']\" : \"'layout-header-nav'\"}}>\n <Link ${serverType === 'koa-next' ? \"page='home'\" : \"href='/' as='/'\"}>\n Home\n </Link>\n <Link ${serverType === 'koa-next' ? \"page='start'\" : \"href='/start' as='/start'\"}>\n Start\n </Link>\n <Link ${serverType === 'koa-next' ? \"page='docs'\" : \"href='/docs' as='/docs'\"}>\n Docs\n </Link>\n </nav>\n </header>\n <div className={${style ? \"styles['layout-content']\" : \"'layout-content'\"}}>\n { children }\n </div>\n <footer className={${style ? \"styles['layout-footer']\" : \"'layout-footer'\"}}>\n Copyright \u00A9 2020 @omni-door\n </footer>\n </main>\n );\n};\n\nexport default memo(Layout);\n`"; exports.tpl_src_component_layout = { tpl: tpl }; exports.default = utils_1.tplEngineInit(exports.tpl_src_component_layout, 'tpl');