From 653bacb2c061b74a705c2262c771a61c095b36eb Mon Sep 17 00:00:00 2001 From: Matt Mo Date: Fri, 18 Sep 2020 13:53:30 -0700 Subject: [PATCH] Working on bootstrap menu component to easily use with Ignite. --- dropdown-menu.js | 29 +++++++++++++++++++++++++++++ ignite-bootstrap.js | 3 +++ 2 files changed, 32 insertions(+) create mode 100644 dropdown-menu.js create mode 100644 ignite-bootstrap.js diff --git a/dropdown-menu.js b/dropdown-menu.js new file mode 100644 index 0000000..54f2efb --- /dev/null +++ b/dropdown-menu.js @@ -0,0 +1,29 @@ +import { IgniteElement } from "../ignite-html/ignite-element.js"; +import { IgniteTemplate, button, ul, slot } from "../ignite-html/ignite-template.js"; + +class DropdownMenu extends IgniteElement { + constructor() { + super(); + } + + render() { + return this.template.child( + new button().class("dropdown-toggle").attribute("data-toggle", "dropdown").child("menu click"), + new ul().class("dropdown-menu").child( + new slot(this) + ) + ); + } +} + +class DropdownMenuTemplate extends IgniteTemplate { + constructor(...children) { + super("bt-dropdown-menu", children); + } +} + +customElements.define("bt-dropdown-menu", DropdownMenu); + +export { + DropdownMenuTemplate as DropdownMenu +}; \ No newline at end of file diff --git a/ignite-bootstrap.js b/ignite-bootstrap.js new file mode 100644 index 0000000..8054835 --- /dev/null +++ b/ignite-bootstrap.js @@ -0,0 +1,3 @@ +import { DropdownMenu } from "./dropdown-menu.js"; + +export { DropdownMenu } \ No newline at end of file