Button
This commit is contained in:
@@ -1,12 +1,23 @@
|
||||
import { html, property, customElement, TemplateResult } from 'lit-element';
|
||||
import {
|
||||
html,
|
||||
property,
|
||||
customElement,
|
||||
TemplateResult,
|
||||
css,
|
||||
CSSResult,
|
||||
unsafeCSS,
|
||||
} from 'lit-element';
|
||||
import { classMap } from 'lit-html/directives/class-map';
|
||||
import { ComponentBase } from '../componentBase';
|
||||
|
||||
//import * as componentCss from "./style.scss";
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const styles = require('!!raw-loader?esModule=false!sass-loader!./style.scss');
|
||||
|
||||
@customElement('adix-button')
|
||||
export class ADIXButton extends ComponentBase {
|
||||
@property() public text = '';
|
||||
@property() public type:
|
||||
| ''
|
||||
| 'primary'
|
||||
| 'secondary'
|
||||
| 'success'
|
||||
@@ -14,25 +25,32 @@ export class ADIXButton extends ComponentBase {
|
||||
| 'warning'
|
||||
| 'info'
|
||||
| 'light'
|
||||
| 'dark' = '';
|
||||
| 'dark' = 'primary';
|
||||
|
||||
@property() public disabled = false;
|
||||
|
||||
public static get styles(): CSSResult[] {
|
||||
return [
|
||||
css`
|
||||
${unsafeCSS(styles)}
|
||||
`,
|
||||
];
|
||||
}
|
||||
|
||||
public render(): TemplateResult {
|
||||
return html`
|
||||
<button
|
||||
class=${classMap({
|
||||
btm: true,
|
||||
primary: this.type === 'primary',
|
||||
secondary: this.type === 'secondary',
|
||||
success: this.type === 'success',
|
||||
danger: this.type === 'danger',
|
||||
warning: this.type === 'warning',
|
||||
info: this.type === 'info',
|
||||
light: this.type === 'light',
|
||||
dark: this.type === 'dark',
|
||||
btn: true,
|
||||
'btn-primary': this.type === 'primary',
|
||||
'btn-secondary': this.type === 'secondary',
|
||||
'btn-success': this.type === 'success',
|
||||
'btn-danger': this.type === 'danger',
|
||||
'btn-warning': this.type === 'warning',
|
||||
'btn-info': this.type === 'info',
|
||||
'btn-light': this.type === 'light',
|
||||
'btn-dark': this.type === 'dark',
|
||||
})}
|
||||
|
||||
?disabled=${this.disabled}
|
||||
>
|
||||
<slot>${this.text}</slot>
|
||||
|
||||
9
src/components/button/style.scss
Normal file
9
src/components/button/style.scss
Normal file
@@ -0,0 +1,9 @@
|
||||
@import "~bootstrap/scss/functions";
|
||||
@import "~bootstrap/scss/variables";
|
||||
@import "~bootstrap/scss/mixins";
|
||||
|
||||
@import "~bootstrap/scss/buttons";
|
||||
|
||||
.test {
|
||||
color: white;
|
||||
}
|
||||
Reference in New Issue
Block a user