tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

dialog-button.stories.mjs (1110B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 import { html } from "chrome://global/content/vendor/lit.all.mjs";
      6 import "chrome://browser/content/preferences/widgets/dialog-button.mjs";
      7 
      8 export default {
      9  title: "Domain-specific UI Widgets/Settings/Dialog Button",
     10  component: "dialog-button",
     11 };
     12 
     13 window.gSubDialog = {
     14  open(dialogId = "dialog-id") {
     15    const dialog = document
     16      .querySelector("with-common-styles")
     17      .shadowRoot.getElementById(dialogId);
     18 
     19    if (!dialog) {
     20      console.error(`Dialog with id "${dialogId}" not found.`);
     21      return;
     22    }
     23 
     24    dialog.showModal();
     25  },
     26 };
     27 
     28 const Template = () => html`
     29  <dialog-button
     30    label="Manage certificates..."
     31    dialog="dialog-id"
     32  ></dialog-button>
     33  <dialog id="dialog-id">
     34    <form method="dialog">
     35      <p>Here's a dialog for demo purposes</p>
     36      <button>Close</button>
     37    </form>
     38  </dialog>
     39 `;
     40 
     41 export const Default = Template.bind({});
     42 Default.args = {};