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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
/* 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 { classMap, html } from "lit.all.mjs";
export default {
title: "UI Widgets/Button",
component: "button",
argTypes: {
size: {
options: ["default", "small"],
control: { type: "radio" },
},
},
parameters: {
actions: {
handles: ["click"],
},
status: "stable",
fluent: `
button-regular = Regular
button-primary = Primary
button-disabled = Disabled
button-danger = Danger
button-small = Small
`,
},
};
const Template = ({
disabled,
primary,
l10nId,
ghostButton,
icon,
dangerButton,
size,
}) =>
html`
<style>
.icon-button {
background-image: url("${icon}");
}
</style>
<button
?disabled=${disabled}
class=${classMap({
primary,
"ghost-button": ghostButton,
"icon-button": icon,
"danger-button": dangerButton,
"small-button": size === "small",
})}
data-l10n-id=${l10nId}
></button>
`;
export const RegularButton = Template.bind({});
RegularButton.args = {
l10nId: "button-regular",
primary: false,
disabled: false,
size: "default",
};
export const PrimaryButton = Template.bind({});
PrimaryButton.args = {
l10nId: "button-primary",
primary: true,
disabled: false,
size: "default",
};
export const DisabledButton = Template.bind({});
DisabledButton.args = {
l10nId: "button-disabled",
primary: false,
disabled: true,
size: "default",
};
export const DangerButton = Template.bind({});
DangerButton.args = {
l10nId: "button-danger",
primary: true,
disabled: false,
dangerButton: true,
size: "default",
};
export const GhostIconButton = Template.bind({});
GhostIconButton.args = {
icon: "chrome://browser/skin/login.svg",
disabled: false,
ghostButton: true,
size: "default",
};
export const SmallButton = Template.bind({});
SmallButton.args = {
l10nId: "button-small",
primary: true,
disabled: false,
size: "small",
};
|