aboutsummaryrefslogtreecommitdiff
path: root/src/components/opacity_input/opacity_input.vue
diff options
context:
space:
mode:
authorMaxim Filippov <colixer@gmail.com>2018-12-17 02:39:37 +0300
committerMaxim Filippov <colixer@gmail.com>2018-12-17 02:39:37 +0300
commit2211c533ddf7a05723afb2e2a8664b9b49c9648d (patch)
treed5bcfbdb55536db01bc0bfda38991db8f159a3e9 /src/components/opacity_input/opacity_input.vue
parent5fc0fe28e45882da0fab635e839a2977104d2f46 (diff)
parentada4bd0d9874d98213cf79ccd9f7cddda36d1b6c (diff)
Merge branch 'develop' into feature/new-user-routes
Diffstat (limited to 'src/components/opacity_input/opacity_input.vue')
-rw-r--r--src/components/opacity_input/opacity_input.vue38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/components/opacity_input/opacity_input.vue b/src/components/opacity_input/opacity_input.vue
new file mode 100644
index 00000000..3926915b
--- /dev/null
+++ b/src/components/opacity_input/opacity_input.vue
@@ -0,0 +1,38 @@
+<template>
+<div class="opacity-control style-control" :class="{ disabled: !present || disabled }">
+ <label :for="name" class="label">
+ {{$t('settings.style.common.opacity')}}
+ </label>
+ <input
+ v-if="typeof fallback !== 'undefined'"
+ class="opt exclude-disabled"
+ :id="name + '-o'"
+ type="checkbox"
+ :checked="present"
+ @input="$emit('input', !present ? fallback : undefined)">
+ <label v-if="typeof fallback !== 'undefined'" class="opt-l" :for="name + '-o'"></label>
+ <input
+ :id="name"
+ class="input-number"
+ type="number"
+ :value="value || fallback"
+ :disabled="!present || disabled"
+ @input="$emit('input', $event.target.value)"
+ max="1"
+ min="0"
+ step=".05">
+</div>
+</template>
+
+<script>
+export default {
+ props: [
+ 'name', 'value', 'fallback', 'disabled'
+ ],
+ computed: {
+ present () {
+ return typeof this.value !== 'undefined'
+ }
+ }
+}
+</script>