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 { classMap } from 'lit-html/directives/class-map';
|
||||||
import { ComponentBase } from '../componentBase';
|
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')
|
@customElement('adix-button')
|
||||||
export class ADIXButton extends ComponentBase {
|
export class ADIXButton extends ComponentBase {
|
||||||
@property() public text = '';
|
@property() public text = '';
|
||||||
@property() public type:
|
@property() public type:
|
||||||
| ''
|
|
||||||
| 'primary'
|
| 'primary'
|
||||||
| 'secondary'
|
| 'secondary'
|
||||||
| 'success'
|
| 'success'
|
||||||
@@ -14,25 +25,32 @@ export class ADIXButton extends ComponentBase {
|
|||||||
| 'warning'
|
| 'warning'
|
||||||
| 'info'
|
| 'info'
|
||||||
| 'light'
|
| 'light'
|
||||||
| 'dark' = '';
|
| 'dark' = 'primary';
|
||||||
|
|
||||||
@property() public disabled = false;
|
@property() public disabled = false;
|
||||||
|
|
||||||
|
public static get styles(): CSSResult[] {
|
||||||
|
return [
|
||||||
|
css`
|
||||||
|
${unsafeCSS(styles)}
|
||||||
|
`,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public render(): TemplateResult {
|
public render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
<button
|
<button
|
||||||
class=${classMap({
|
class=${classMap({
|
||||||
btm: true,
|
btn: true,
|
||||||
primary: this.type === 'primary',
|
'btn-primary': this.type === 'primary',
|
||||||
secondary: this.type === 'secondary',
|
'btn-secondary': this.type === 'secondary',
|
||||||
success: this.type === 'success',
|
'btn-success': this.type === 'success',
|
||||||
danger: this.type === 'danger',
|
'btn-danger': this.type === 'danger',
|
||||||
warning: this.type === 'warning',
|
'btn-warning': this.type === 'warning',
|
||||||
info: this.type === 'info',
|
'btn-info': this.type === 'info',
|
||||||
light: this.type === 'light',
|
'btn-light': this.type === 'light',
|
||||||
dark: this.type === 'dark',
|
'btn-dark': this.type === 'dark',
|
||||||
})}
|
})}
|
||||||
|
|
||||||
?disabled=${this.disabled}
|
?disabled=${this.disabled}
|
||||||
>
|
>
|
||||||
<slot>${this.text}</slot>
|
<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