Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions typescript/packages/common-ui/src/components/include.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { LitElement, html } from "lit-element";
import { customElement, property } from "lit-element/decorators.js";
import { view, render, RenderContext } from "../hyperscript/render.js";
import { VNode } from "../hyperscript/view.js";
import { eventProps } from "../hyperscript/schema-helpers.js";

export const include = view("common-include", {
...eventProps(),
// TODO; This should be split into two properties, vdom and context
content: { type: "array" },
});

@customElement("common-include")
export class IncludeElement extends LitElement {
@property({ type: Array })
content: [VNode, RenderContext];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could expose this as two properties: content and context, otherwise LGTM


override render() {
const element = render(...this.content);

return html`${element}`;
}
}
1 change: 1 addition & 0 deletions typescript/packages/common-ui/src/hyperscript/tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export { span } from "../components/span.js";
export { h1 } from "../components/h1.js";
export { p } from "../components/p.js";
export { button } from "../components/button.js";
export { include } from "../components/include.js";