fix(core): update

This commit is contained in:
2021-08-27 13:38:08 +02:00
parent 54ce305cf1
commit 2f52f14cf9
6 changed files with 231 additions and 20 deletions

View File

@@ -19,7 +19,17 @@ declare global {
@customElement('dees-button')
export class DeesButton extends DeesElement {
public static demo = () => html`<dees-button>This is a slotted Text</dees-button>`;
public static demo = () => html`
<dees-button>This is a slotted Text</dees-button>
<p><dees-button text="Highlighted: This text shows" type="highlighted">Highlighted</dees-button></p>
<p><dees-button type="discreet">This is discreete button</dees-button></p>
<p><dees-button disabled>This is a disabled button</dees-button></p>
<p><dees-button type="big">This is a slotted Text</dees-button></p>
<p><dees-button status="normal">Normal Status</dees-button></p>
<p><dees-button disabled status="pending">Pending Status</dees-button></p>
<p><dees-button disabled status="success">Success Status</dees-button></p>
<p><dees-button disabled status="error">Error Status</dees-button></p>
`;
@property()
public text: string;
@@ -32,12 +42,21 @@ export class DeesButton extends DeesElement {
})
public disabled = false;
@property()
@property({
type: Boolean
})
public isHidden = false;
@property()
@property({
type: String
})
public type: 'normal' | 'highlighted' | 'discreet' | 'big' = 'normal';
@property({
type: String
})
public status: 'normal' | 'pending' | 'success' | 'error' = 'normal';
constructor() {
super();
}
@@ -54,10 +73,12 @@ export class DeesButton extends DeesElement {
}
.button {
position: relative;
transition: all 0.2s ease;
font-size: 14px;
display: block;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
background: ${cssManager.bdTheme('#eee', '#333')};
box-shadow: ${cssManager.bdTheme('0px 0px 5px rgba(0,0,0,0.1)', 'none')};
border-top: ${cssManager.bdTheme('1px solid #eee', '1px solid #444')};
@@ -67,6 +88,7 @@ export class DeesButton extends DeesElement {
min-width: 100px;
user-select: none;
color: ${cssManager.bdTheme('#333', ' #ccc')};
max-width: 500px;
}
.button:hover {
@@ -91,41 +113,71 @@ export class DeesButton extends DeesElement {
.button.highlighted {
background: #e4002b;
border: none;
color: #fff;
}
.button.highlighted:hover {
background: #b50021;
border: none;
color: #fff;
}
.button.discreet {
background: none;
border: 1px solid #9b9b9e;
color: #000;
color: ${cssManager.bdTheme('#000', '#fff')};
}
.button.discreet:hover {
background: rgba(0, 0, 0, 0.1);
background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
}
.hidden {
.button.hidden {
display: none;
}
.big {
display: inline-block;
.button.big {
width: 300px;
line-height: 48px;
font-size: 16px;
padding: 0px 48px;
margin-top: 36px;
}
.button.pending {
background: #0277bd70;
color: #fff;
}
.button.success {
background: #8BC34A70;
color: #fff;
}
.button.error {
background: #E64A1970;
color: #fff;
}
dees-spinner {
position: absolute;
left: 10px;
}
`,
];
public render(): TemplateResult {
return html`
<div
class="button ${this.isHidden ? 'hidden' : 'block'} ${this.type} ${this.disabled
class="button ${this.isHidden ? 'hidden' : 'block'} ${this.type} ${this.status} ${this.disabled
? 'disabled'
: null}"
@click="${this.dispatchClick}"
>
${this.text ? this.text : html`<slot></slot>`}
${this.status === 'normal' ? html``: html`
<dees-spinner status="${this.status}"></dees-spinner>
`}
<div class="textbox">${this.text ? this.text : html`<slot></slot>`}</div>
</div>
`;
}