Files
exploRUGComponent/docs-src/_includes/example.11ty.cjs
Kevin Schaaf fddb01149c Update lit-starter-ts to lit-next
* Upgrades the source to work with lit-next
* Aligns the linting and formatting rules/settings & ignores with the monorepo
* Upgrades to the same version of typescript and tsconfig settings as the monorepo
* Upgrades the test runner from karma to web-test-runner
* Upgrades the dev server from es-dev-server to @web/dev-server
2021-01-29 17:35:17 -08:00

44 lines
1.0 KiB
JavaScript

const page = require('./page.11ty.cjs');
const relative = require('./relative-path.cjs');
/**
* This template extends the page template and adds an examples list.
*/
module.exports = function (data) {
return page({
...data,
content: renderExample(data),
});
};
const renderExample = ({name, content, collections, page}) => {
return `
<h1>Example: ${name}</h1>
<section class="examples">
<nav class="collection">
<ul>
${
collections.example === undefined
? ''
: collections.example
.map(
(post) => `
<li class=${post.url === page.url ? 'selected' : ''}>
<a href="${relative(
page.url,
post.url
)}">${post.data.description.replace('<', '&lt;')}</a>
</li>
`
)
.join('')
}
</ul>
</nav>
<div>
${content}
</div>
</section>
`;
};