aboutsummaryrefslogtreecommitdiff
path: root/src/components/range_input/range_input.vue
diff options
context:
space:
mode:
authorHJ <spam@hjkos.com>2018-12-11 20:35:19 +0000
committerHJ <spam@hjkos.com>2018-12-11 20:35:19 +0000
commita8acba8cb2c639a3de3764df4226960458f996b8 (patch)
tree50c4d353576cc419eeea4f45c4497309222cf360 /src/components/range_input/range_input.vue
parentfb5261b926adfb5b9bbe1bf55e36fe8b5f4eb57f (diff)
parent8fcc4c67667b0951d6c0d28cec320bd4b2f8f107 (diff)
Merge branch 'feature/theming2' into 'develop'
Themes v2 See merge request pleroma/pleroma-fe!377
Diffstat (limited to 'src/components/range_input/range_input.vue')
-rw-r--r--src/components/range_input/range_input.vue48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/components/range_input/range_input.vue b/src/components/range_input/range_input.vue
new file mode 100644
index 00000000..3e50664b
--- /dev/null
+++ b/src/components/range_input/range_input.vue
@@ -0,0 +1,48 @@
+<template>
+<div class="range-control style-control" :class="{ disabled: !present || disabled }">
+ <label :for="name" class="label">
+ {{label}}
+ </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="range"
+ :value="value || fallback"
+ :disabled="!present || disabled"
+ @input="$emit('input', $event.target.value)"
+ :max="max || hardMax || 100"
+ :min="min || hardMin || 0"
+ :step="step || 1">
+ <input
+ :id="name"
+ class="input-number"
+ type="number"
+ :value="value || fallback"
+ :disabled="!present || disabled"
+ @input="$emit('input', $event.target.value)"
+ :max="hardMax"
+ :min="hardMin"
+ :step="step || 1">
+</div>
+</template>
+
+<script>
+export default {
+ props: [
+ 'name', 'value', 'fallback', 'disabled', 'label', 'max', 'min', 'step', 'hardMin', 'hardMax'
+ ],
+ computed: {
+ present () {
+ return typeof this.value !== 'undefined'
+ }
+ }
+}
+</script>