Merge branch 'master' into add-multiline-text
This commit is contained in:
commit
93607fde0c
|
@ -3,3 +3,4 @@
|
|||
@import './files.scss';
|
||||
@import './dropdowns.scss';
|
||||
@import './radios.scss';
|
||||
@import './sliders.scss';
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
.bd-form-dropdown,
|
||||
.bd-form-radio,
|
||||
.bd-form-numberinput,
|
||||
.bd-form-slider,
|
||||
.bd-setting-switch {
|
||||
.bd-title {
|
||||
display: flex;
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
.bd-slider {
|
||||
height: 24px;
|
||||
|
||||
.bd-slider-container {
|
||||
margin-top: 8px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.bd-slider-bar {
|
||||
background-color: #4f545c;
|
||||
height: 8px;
|
||||
border-radius: 4px;
|
||||
|
||||
.bd-slider-bar-filled {
|
||||
background-color: $colbdblue;
|
||||
height: 8px;
|
||||
border-radius: 4px 0 0 4px;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
input {
|
||||
border-radius: 4px;
|
||||
display: block;
|
||||
height: 8px;
|
||||
background-color: transparent;
|
||||
outline: none;
|
||||
width: 180px;
|
||||
margin: -8px 0 0;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
|
||||
&::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
-webkit-box-shadow: 0 3px 1px 0 rgba(0,0,0,.05), 0 2px 2px 0 rgba(0,0,0,.1), 0 3px 3px 0 rgba(0,0,0,.05);
|
||||
background-color: #fff;
|
||||
border: 1px solid #dcddde;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 3px 1px 0 rgba(0,0,0,.05), 0 2px 2px 0 rgba(0,0,0,.1), 0 3px 3px 0 rgba(0,0,0,.05);
|
||||
cursor: ew-resize;
|
||||
height: 24px;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
width: 10px;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,6 +16,7 @@
|
|||
<RadioSetting v-if="setting.type === 'radio'" :setting="setting" :change="change"/>
|
||||
<StringSetting v-if="setting.type === 'text' && !setting.multiline" :setting="setting" :change="change"/>
|
||||
<MultilineTextSetting v-if="setting.type === 'text' && setting.multiline" :setting="setting" :change="change"/>
|
||||
<SliderSetting v-if="setting.type === 'slider'" :setting="setting" :change="change"/>
|
||||
<FileSetting v-if="setting.type === 'file'" :setting="setting" :change="change"/>
|
||||
<div class="bd-form-divider"></div>
|
||||
</div>
|
||||
|
@ -28,6 +29,7 @@
|
|||
import RadioSetting from './Radio.vue';
|
||||
import StringSetting from './String.vue';
|
||||
import MultilineTextSetting from './Multiline.vue';
|
||||
import SliderSetting from './Slider.vue';
|
||||
import FileSetting from './File.vue';
|
||||
|
||||
export default {
|
||||
|
@ -43,6 +45,7 @@
|
|||
RadioSetting,
|
||||
StringSetting,
|
||||
MultilineTextSetting,
|
||||
SliderSetting,
|
||||
FileSetting
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* BetterDiscord Plugin Setting Slider Component
|
||||
* Copyright (c) 2015-present Jiiks/JsSucks - https://github.com/Jiiks / https://github.com/JsSucks
|
||||
* All rights reserved.
|
||||
* https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
<template>
|
||||
<div class="bd-form-slider">
|
||||
<div class="bd-title">
|
||||
<h3>{{ setting.text }}</h3>
|
||||
<div class="bd-slider">
|
||||
<div class="bd-slider-container">
|
||||
<div class="bd-slider-bar">
|
||||
<div class="bd-slider-bar-filled" :style="'width: ' + (((this.setting.value - (this.setting.min || 0)) / ((this.setting.max || 100) - (this.setting.min || 0))) * 100) + '%;'"></div>
|
||||
</div>
|
||||
<input type="range" :value="setting.value" :min="setting.min || 0" :max="setting.max || 100" :step="setting.step || 1" @keyup.stop @input="input" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bd-hint">{{ setting.hint }}</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: ['setting', 'change'],
|
||||
data() {
|
||||
return {
|
||||
fillpercentage: 0
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
input(e) {
|
||||
let number = parseFloat(e.target.value);
|
||||
if (Number.isNaN(number)) return;
|
||||
|
||||
this.change(this.setting.id, number);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -68,6 +68,16 @@
|
|||
"text": "Multiline Text Test Setting",
|
||||
"hint": "Multiline Text Test Setting Hint"
|
||||
},
|
||||
{
|
||||
"id": "test-slider-1",
|
||||
"type": "slider",
|
||||
"value": 0,
|
||||
"min": 0,
|
||||
"max": 100,
|
||||
"step": 1,
|
||||
"text": "Slider Test Setting",
|
||||
"hint": "Slider Test Setting Hint"
|
||||
},
|
||||
{
|
||||
"id": "default-3",
|
||||
"type": "file",
|
||||
|
|
Loading…
Reference in New Issue