generated from adamrybinski/haunted-snow
-
Notifications
You must be signed in to change notification settings - Fork 1
/
mulButton.js
50 lines (47 loc) · 1.29 KB
/
mulButton.js
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
import { useCSS, html, css, component } from './deps.js';
import {
bodyShortFontSize1, boxShadow, activePrimary, bodyShortFontWeight1, bodyShortLineHeight1, bodyShortLetterSpacing1,
disabled2, disabled3, focus, interactive1, spacing3, spacing8, spacing9, text4
} from './cssTokens.js';
function MulButton(element) {
useCSS(element, [mulDefaultButton])
return html`
${buttonTemplate(element)}
`
}
MulButton.observedAttributes = ['disabled', 'onclick']
const buttonTemplate = ({ disabled, onclick}) => html`
<button type="button" ?disabled=${disabled} @click=${onclick}>
<slot></slot>
</button>
`
const mulDefaultButton = css`
button {
height: ${spacing9};
padding-right: ${spacing8};
padding-left: ${spacing3};
background-color: ${interactive1};
color: ${text4};
font-size: ${bodyShortFontSize1};
font-weight: ${bodyShortFontWeight1};
line-height: ${bodyShortLineHeight1};
letter-spacing: ${bodyShortLetterSpacing1};
border: transparent;
cursor: pointer;
}
button:active {
background-color: ${activePrimary};
cursor: default;
}
button:disabled {
border-color: ${activePrimary};
background: ${disabled2};
color: ${disabled3};
cursor: default;
}
button:focus {
border-color: ${focus};
box-shadow: ${boxShadow};
}
`
customElements.define("mul-button", component(MulButton))