summaryrefslogtreecommitdiffstats
path: root/browser/components/storybook/stories/button.stories.mjs
blob: b0d6b044015f34b41465d07820c1114adb7d39ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { html } from "lit";
import { classMap } from "lit/directives/class-map.js";

export default {
  title: "Design System/Atoms/Button",
};

const Template = ({ disabled, primary, text, ghostButton, icon }) =>
  html`
    <style>
      .icon-button {
        background-image: url("${icon}");
      }
    </style>
    <button
      ?disabled=${disabled}
      class=${classMap({
        primary,
        "ghost-button": ghostButton,
        "icon-button": icon,
      })}
    >
      ${text}
    </button>
  `;

export const RegularButton = Template.bind({});
RegularButton.args = {
  text: "Regular",
  primary: false,
  disabled: false,
};
export const PrimaryButton = Template.bind({});
PrimaryButton.args = {
  text: "Primary",
  primary: true,
  disabled: false,
};
export const DisabledButton = Template.bind({});
DisabledButton.args = {
  text: "Disabled",
  primary: false,
  disabled: true,
};

export const GhostIconButton = Template.bind({});
GhostIconButton.args = {
  text: "",
  icon: "chrome://browser/skin/login.svg",
  disabled: false,
  ghostButton: true,
};