forked from moritzebeling/kirby-panel-button
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes moritzebeling#2 moritzebeling#3
- Loading branch information
Showing
5 changed files
with
72 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
p{margin-bottom:var(--spacing-2)}.k-button-field-button{display:block;width:100%;text-align:left} | ||
[dir=ltr] .k-button-field button{text-align:left}[dir=rtl] .k-button-field button{text-align:right}.k-button-field button{width:100%;justify-content:start} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,79 @@ | ||
<template> | ||
<k-field class="k-button-field" :label="label" :help="help"> | ||
<k-field class="k-button-field" :label="label" :help="help"> | ||
<div class="k-button-field-button-wrapper"> | ||
<k-button | ||
v-if="!isLoading" | ||
:theme="theme" | ||
:icon="icon" | ||
variant="filled" | ||
@click="onClick" | ||
> | ||
{{ text }} | ||
</k-button> | ||
|
||
<div class="k-button-field-button-wrapper"> | ||
<k-button | ||
v-if="isLoading && !hasError" | ||
:disabled="true" | ||
icon="dots" | ||
theme="info" | ||
variant="filled" | ||
data-disabled="true" | ||
> | ||
Please wait | ||
</k-button> | ||
|
||
<button v-if="!isLoading" type="button" class="k-button-field-button k-button k-box" :data-theme="theme" @click="onClick"> | ||
<k-icon :type="icon" class="k-button-icon" /> | ||
<span class="k-button-text">{{ text }}</span> | ||
</button> | ||
|
||
<div v-if="isLoading && !hasError" type="button" class="k-button-field-button k-button k-button-disabled k-box" data-disabled="true"> | ||
<k-icon type="dots" class="k-button-icon" /> | ||
<span class="k-button-text">Please wait</span> | ||
</div> | ||
|
||
<div v-if="hasError" type="button" class="k-button-field-button k-button k-button-disabled k-box" data-disabled="true" data-theme="negative"> | ||
<k-icon type="alert" class="k-button-icon" /> | ||
<span class="k-button-text">Error</span> | ||
</div> | ||
|
||
</div> | ||
|
||
</k-field> | ||
<k-button | ||
v-if="hasError" | ||
:disabled="true" | ||
icon="alert" | ||
theme="negative" | ||
variant="filled" | ||
@click="onClick" | ||
> | ||
Error | ||
</k-button> | ||
</div> | ||
</k-field> | ||
</template> | ||
|
||
<script> | ||
import {openUrlInNewTab, triggerWebhook} from "./methods"; | ||
import { openUrlInNewTab, triggerWebhook } from "./methods"; | ||
export default { | ||
props: { | ||
label: String, | ||
text: String, | ||
url: String, | ||
theme: String, | ||
icon: String, | ||
open: Boolean, | ||
reload: Boolean, | ||
help: String, | ||
isLoading: true, | ||
hasError: false | ||
}, | ||
methods: { | ||
async onClick(){ | ||
if( this.open === true ){ | ||
/* | ||
open url in new tab | ||
*/ | ||
openUrlInNewTab( this ); | ||
} else { | ||
/* | ||
trigger webhook | ||
*/ | ||
triggerWebhook( this ); | ||
} | ||
} | ||
} | ||
export default { | ||
props: { | ||
label: String, | ||
text: String, | ||
url: String, | ||
theme: String, | ||
icon: String, | ||
open: Boolean, | ||
reload: Boolean, | ||
help: String, | ||
isLoading: true, | ||
hasError: false | ||
}, | ||
methods: { | ||
async onClick() { | ||
if (this.open === true) { | ||
/* | ||
open url in new tab | ||
*/ | ||
openUrlInNewTab(this); | ||
} else { | ||
/* | ||
trigger webhook | ||
*/ | ||
triggerWebhook(this); | ||
} | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style> | ||
p { | ||
margin-bottom: var(--spacing-2); | ||
} | ||
.k-button-field-button { | ||
display: block; | ||
width: 100%; | ||
text-align: left; | ||
} | ||
</style> | ||
.k-button-field button { | ||
width: 100%; | ||
text-align: start; | ||
justify-content: start; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters