Adds option for widget labels (#769)

This commit is contained in:
Lissy93 2022-07-02 22:28:39 +01:00
parent 4210c985b7
commit eff49995b9
2 changed files with 10 additions and 3 deletions

View File

@ -123,7 +123,7 @@ export default {
if (emojiLookup[emojiCode]) { if (emojiLookup[emojiCode]) {
return emojiLookup[emojiCode]; return emojiLookup[emojiCode];
} else { } else {
this.imageNotFound(`No emoji found with name '${emojiCode}'`); // this.imageNotFound(`No emoji found with name '${emojiCode}'`);
return null; return null;
} }
}, },

View File

@ -18,6 +18,8 @@
<p class="error-output">{{ errorMsg }}</p> <p class="error-output">{{ errorMsg }}</p>
<p class="retry-link" @click="update">Retry</p> <p class="retry-link" @click="update">Retry</p>
</div> </div>
<!-- Widget Label -->
<div class="widget-label" v-if="widgetOptions.label">{{ widgetOptions.label }}</div>
<!-- Widget --> <!-- Widget -->
<div :class="`widget-wrap ${ error ? 'has-error' : '' }`"> <div :class="`widget-wrap ${ error ? 'has-error' : '' }`">
<component <component
@ -142,11 +144,12 @@ export default {
const options = this.widget.options || {}; const options = this.widget.options || {};
const timeout = this.widget.timeout || null; const timeout = this.widget.timeout || null;
const ignoreErrors = this.widget.ignoreErrors || false; const ignoreErrors = this.widget.ignoreErrors || false;
const label = this.widget.label || null;
const useProxy = this.appConfig.widgetsAlwaysUseProxy || !!this.widget.useProxy; const useProxy = this.appConfig.widgetsAlwaysUseProxy || !!this.widget.useProxy;
const updateInterval = this.widget.updateInterval !== undefined const updateInterval = this.widget.updateInterval !== undefined
? this.widget.updateInterval : null; ? this.widget.updateInterval : null;
return { return {
timeout, ignoreErrors, useProxy, updateInterval, ...options, timeout, ignoreErrors, label, useProxy, updateInterval, ...options,
}; };
}, },
/* A unique string to reference the widget by */ /* A unique string to reference the widget by */
@ -219,7 +222,11 @@ export default {
right: 1.75rem; right: 1.75rem;
} }
} }
// Optional widget label
.widget-label {
color: var(--widget-text-color);
}
// Actual widget container
.widget-wrap { .widget-wrap {
&.has-error { &.has-error {
cursor: not-allowed; cursor: not-allowed;