Merge branch 'master' into add-modal-animation

This commit is contained in:
Alexei Stukov 2018-02-04 14:28:56 +02:00 committed by GitHub
commit 996ab6a73f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 314 additions and 151 deletions

View File

@ -32,7 +32,7 @@
}
}
&.active {
&.bd-active {
background: transparent;
opacity: 1;
box-shadow: none;

View File

@ -2,4 +2,5 @@
@import './sidebarview.scss';
@import './plugins.scss';
@import './plugincard.scss';
@import './tooltips.scss';
@import './tooltips.scss';
@import './plugin-settings-modal.scss';

View File

@ -0,0 +1,63 @@
.bd-plugin-settings-modal {
.bd-modal .bd-modal-body {
padding: 0;
}
.bd-plugin-settings-body {
padding: 0 15px;
.bd-setting-switch {
.bd-switch-wrapper {
flex: 0 0 auto;
user-select: none;
position: relative;
width: 40px;
height: 20px;
display: block;
input {
position: absolute;
opacity: 0;
cursor: pointer;
width: 100%;
height: 100%;
z-index: 1;
}
.bd-switch {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: #72767d;
border-radius: 14px;
transition: background .15s ease-in-out,box-shadow .15s ease-in-out,border .15s ease-in-out;
&:before {
content: "";
display: block;
width: 14px;
height: 14px;
position: absolute;
top: 3px;
left: 3px;
bottom: 3px;
background: #f6f6f7;
border-radius: 10px;
transition: all .15s ease;
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);
}
&.bd-checked {
background: $colbdblue;
&::before {
transform: translateX(20px);
}
}
}
}
}
}
}

View File

@ -110,61 +110,3 @@
}
}
}
.bd-plugin-settings-body {
margin-bottom: 80px;
.bd-setting-switch {
.bd-switch-wrapper {
flex: 0 0 auto;
user-select: none;
position: relative;
width: 40px;
height: 20px;
display: block;
input {
position: absolute;
opacity: 0;
cursor: pointer;
width: 100%;
height: 100%;
z-index: 1;
}
.bd-switch {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: #72767d;
border-radius: 14px;
transition: background .15s ease-in-out,box-shadow .15s ease-in-out,border .15s ease-in-out;
&:before {
content: "";
display: block;
width: 14px;
height: 14px;
position: absolute;
top: 3px;
left: 3px;
bottom: 3px;
background: #f6f6f7;
border-radius: 10px;
transition: all .15s ease;
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);
}
&.bd-checked {
background: $colbdblue;
&::before {
transform: translateX(20px);
}
}
}
}
}
}

View File

@ -98,3 +98,16 @@
}
}
}
.bd-settings .bd-sidebar-view.bd-stop .bd-content-region {
z-index: 3003;
}
.bd-backdrop {
z-index: 3003;
}
.bd-sidebar .bd-settings-button {
position: absolute;
top: 0;
}

View File

@ -0,0 +1,29 @@
.bd-drawer {
.bd-drawer-open-button {
svg {
transition: transform 0.2s ease;
transform: rotate(0deg);
}
}
.bd-drawer-contents {
display: none;
}
&:not(.bd-drawer-open) {
padding-bottom: 5px;
border-bottom: 1px solid rgba(114, 118, 126, 0.3);
}
&.bd-drawer-open {
.bd-drawer-open-button {
svg {
transform: rotate(45deg);
}
}
.bd-drawer-contents {
display: block;
}
}
}

View File

@ -1,3 +1,39 @@
.bd-form-header {
margin: 15px 0 10px;
color: rgba(255, 255, 255, 0.15);
font-size: 14px;
font-weight: 700;
line-height: 16px;
text-transform: uppercase;
font-weight: 600;
flex-shrink: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-family: Whitney, Helvetica Neue, Helvetica, Arial, sans-serif;
display: flex;
.bd-form-header-text {
flex: 1 1 auto;
}
.bd-form-header-button {
flex: 0 0;
margin-left: 5px;
svg {
width: 16px;
height: 16px;
cursor: pointer;
fill: #ccc;
&:hover {
fill: #fff;
}
}
}
}
.bd-form-item h5 {
color: #b9bbbe;
text-transform: uppercase;
@ -14,7 +50,7 @@
.bd-form-textinput + &,
.bd-form-fileinput + &,
.bd-setting-switch + & {
margin: 0 0 15px 0;
margin: 15px 0;
}
}
@ -59,7 +95,8 @@
}
.bd-form-textinput,
.bd-form-fileinput {
.bd-form-fileinput,
.bd-setting-switch {
.bd-title {
display: flex;
@ -79,7 +116,6 @@
font-size: 14px;
font-weight: 500;
margin-top: 5px;
margin-bottom: 15px;
line-height: 20px;
border-bottom: 0px solid rgba(114, 118, 126, 0.1);
}

View File

@ -4,4 +4,5 @@
@import './buttons.scss';
@import './forms.scss';
@import './material-buttons.scss';
@import './modals.scss';
@import './modals.scss';
@import './drawers.scss';

View File

@ -1,5 +1,5 @@
.bd-backdrop {
position: absolute;
position: fixed;
right: 0px;
left: 0px;
top: 0px;
@ -8,11 +8,6 @@
opacity: .85;
padding: 20px;
z-index: 9000;
animation: bd-backdrop-in 0.22s ease;
&.bd-backdrop-out {
animation: bd-backdrop-out 0.22s ease;
}
}
.bd-modal {
@ -36,8 +31,9 @@
box-sizing: border-box;
pointer-events: none;
z-index: 9001;
justify-content: center;
animation: bd-modal-in 0.22s ease;
&.bd-modal-out {
animation: bd-modal-out 0.22s ease;
}
@ -56,6 +52,8 @@
flex-grow: 1;
border-radius: 4px;
max-height: 100%;
max-width: 500px;
width: 500px;
}
.bd-modal .bd-modal-body {
@ -66,46 +64,58 @@
.bd-modal-header {
display: flex;
padding: 15px;
flex: 0 0;
-webkit-transition: -webkit-box-shadow .1s ease-out;
transition: -webkit-box-shadow .1s ease-out;
transition: box-shadow .1s ease-out;
.bd-modal-headertext {
color: #FFF;
font-weight: 700;
margin-bottom: 15px;
padding-bottom: 15px;
flex-grow: 1;
line-height: 18px;
padding: 1px;
}
.bd-modal-x {
display: flex;
width: 20px;
height: 20px;
border: 1px solid transparent;
border-radius: 3px;
cursor: pointer;
align-content: center;
justify-content: center;
align-items: center;
margin-left: -2px -2px -2px 10px;
padding: 2px;
.bd-material-design-icon {
fill: #FFF;
fill: #ccc;
}
&:hover {
background: #2d2f34;
.bd-material-design-icon {
fill: #fff;
}
}
}
}
&.bd-modal-scrolled .bd-modal-header {
-webkit-box-shadow: 0 1px 0 0 rgba(24,25,28,.3), 0 1px 2px 0 rgba(24,25,28,.3);
box-shadow: 0 1px 0 0 rgba(24,25,28,.3), 0 1px 2px 0 rgba(24,25,28,.3);
}
.bd-modal-body {
padding: 0 15px;
}
.bd-modal-footer {
.bd-footer-alert {
position: absolute;
bottom: 80px;
left: 70px;
right: 70px;
margin: 10px;
height: 0;
display: flex;
background-color: rgba(32, 34, 37, 0.9);
box-shadow: 0 2px 10px 0 rgba(0,0,0,.2);
@ -122,6 +132,7 @@
}
&.bd-active {
height: auto;
opacity: 1;
transform: none;
}
@ -149,4 +160,4 @@
}
}
}
}
}

View File

@ -7,20 +7,6 @@
-webkit-box-align: stretch;
align-items: stretch;
.bd-title {
display: flex;
justify-content: flex-start;
-webkit-box-align: stretch;
align-items: stretch;
-webkit-box-direction: normal;
-webkit-box-orient: horizontal;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
flex-direction: row;
box-sizing: border-box;
}
.bd-switch-wrapper {
flex: 0 0 auto;
user-select: none;
@ -73,36 +59,15 @@
}
}
.bd-title h3 {
font-weight: 500;
color: #f6f6f7;
flex: 1;
line-height: 24px;
margin-bottom: 0;
margin-top: 0;
.bd-setting-switch-wrap {
transition: opacity 0.2s ease;
}
.bd-hint {
flex: 1 1 auto;
color: #72767d;
font-size: 14px;
font-weight: 500;
margin-bottom: 15px;
line-height: 30px;
border-bottom: 0px solid hsla(218,5%,47%,.1);
}
&.bd-disabled .bd-setting-switch-wrap {
opacity: 0.6;
+ .bd-form-divider {
margin: 0 0 10px 0;
}
&.bd-disabled {
input {
cursor: not-allowed;
}
.bd-switch::before {
background: #888888;
&, input {
cursor: not-allowed !important;
}
}
}

View File

@ -17,3 +17,7 @@
.bd-flex-spacer {
flex-grow: 1;
}
.bd-hide {
display: none;
}

View File

@ -36,7 +36,9 @@
> div:not(.active) {
opacity: 0;
position: absolute;
width: 100%;
left: 310px;
right: 0;
// width: 100%;
height: 100%;
pointer-events: none;
}

View File

@ -39,9 +39,15 @@
backface-visibility: hidden;
}
&.bd-stop {
.bd-content-region {
transform: none;
}
}
&.active {
.bd-content-region {
animation: bd-slidein .6s forwards;
animation: bd-slidein .6s;
}
}
}

View File

@ -10,8 +10,11 @@
<template>
<div class="bd-settings" :class="{active: active}" @keyup="close">
<SidebarView :contentVisible="this.activeIndex >= 0" :animating="this.animating">
<SidebarView :contentVisible="this.activeIndex >= 0" :animating="this.animating" :class="{'bd-stop': !first}">
<Sidebar slot="sidebar">
<div class="bd-settings-button bd-active">
<div class="bd-settings-button-btn"></div>
</div>
<div class="bd-settings-x" @click="close">
<MiClose size="17"/>
<span class="bd-x-text">ESC</span>
@ -101,11 +104,8 @@
this.lastActiveIndex = this.activeIndex;
this.activeIndex = id;
if (this.first) {
this.first = false;
}
setTimeout(() => {
this.first = false;
this.animating = false;
this.lastActiveIndex = -1;
}, 400);

View File

@ -10,7 +10,7 @@
<template>
<div class="bd-settings-wrapper" :class="[{active: active}, 'platform-' + this.platform]">
<div class="bd-settings-button" :class="{active: active}" @click="showSettings">
<div class="bd-settings-button" :class="{'bd-hide': active}" @click="showSettings">
<div class="bd-settings-button-btn" :class="[{'bd-loading': !loaded}]"></div>
</div>
<BdSettings :active="active" :close="hideSettings" />
@ -40,6 +40,7 @@
hideSettings() { this.active = false },
toggleSettings() { this.active = !this.active },
keyupListener(e) {
if (document.getElementsByClassName('bd-backdrop').length) return;
if (this.active && e.which === 27) return this.hideSettings();
if (!e.metaKey && !e.ctrlKey || e.key !== 'b') return;
this.toggleSettings();

View File

@ -9,8 +9,8 @@
*/
<template>
<div>
<div class="bd-backdrop" :class="{'bd-backdrop-out': closing}" @click="attemptToClose"></div>
<div class="bd-plugin-settings-modal">
<div class="bd-backdrop" @click="attemptToClose" :class="{'bd-backdrop-out': closing}"></div>
<Modal :headerText="plugin.name + ' Settings'" :close="attemptToClose" :class="{'bd-modal-out': closing}">
<div slot="body" class="bd-plugin-settings-body">
<template v-for="category in configCache">
@ -18,13 +18,14 @@
<PluginSetting v-for="setting in category.settings" :key="setting.id" :setting="setting" :change="settingChange" />
</div>
<div v-else-if="category.type === 'static'">
{{category.category}} static with header
<div class="bd-form-header">
<span class="bd-form-header-text">{{category.category}} static with header</span>
</div>
<PluginSetting v-for="setting in category.settings" :key="setting.id" :setting="setting" :change="settingChange" />
</div>
<div v-else-if="category.type === 'drawer'">
{{category.category}} drawer
<Drawer v-else-if="category.type === 'drawer'" :label="category.category + ' drawer'">
<PluginSetting v-for="setting in category.settings" :key="setting.id" :setting="setting" :change="settingChange" />
</div>
</Drawer>
<div v-else>
<PluginSetting v-for="setting in category.settings" :key="setting.id" :setting="setting" :change="settingChange" />
</div>
@ -43,6 +44,7 @@
// Imports
import { Modal } from '../common';
import PluginSetting from './pluginsetting/PluginSetting.vue';
import Drawer from '../common/Drawer.vue';
export default {
props: ['plugin','close'],
@ -56,7 +58,8 @@
},
components: {
Modal,
PluginSetting
PluginSetting,
Drawer
},
methods: {
checkForChanges() {
@ -89,14 +92,13 @@
this.changed = false;
},
attemptToClose(e) {
if (!this.changed) {
if (!this.chagned) {
this.closing = true;
window.setTimeout(() => {
this.close();
}, 200);
setTimeout(() => {
this.close();
}, 200);
return;
}
this.warnclose = true;
setTimeout(() => {
this.warnclose = false;

View File

@ -0,0 +1,39 @@
/**
* BetterDiscord Drawer 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-drawer', {'bd-drawer-open': open}]">
<div class="bd-form-header bd-drawer-header">
<span class="bd-form-header-text">{{ label }}</span>
<span class="bd-form-header-button bd-drawer-open-button" @click="() => open = !open"><MiPlus /></span>
</div>
<div class="bd-drawer-contents">
<slot />
</div>
</div>
</template>
<script>
import { MiPlus } from './MaterialIcon';
export default {
props: [
'label'
],
components: {
MiPlus
},
data() {
return {
open: false
}
}
}
</script>

View File

@ -8,3 +8,4 @@ export { default as MiClose } from './materialicons/Close.vue';
export { default as MiMinus } from './materialicons/Minus.vue';
export { default as MiOpenInNew } from './materialicons/OpenInNew.vue';
export { default as MiTwitterCircle } from './materialicons/TwitterCircle.vue';
export { default as MiPlus } from './materialicons/Plus.vue';

View File

@ -1,5 +1,5 @@
/**
* BetterDiscord ¨Modal Component
* BetterDiscord Modal Component
* Copyright (c) 2015-present Jiiks/JsSucks - https://github.com/Jiiks / https://github.com/JsSucks
* All rights reserved.
* https://betterdiscord.net
@ -9,7 +9,7 @@
*/
<template>
<div class="bd-modal">
<div :class="['bd-modal', {'bd-modal-scrolled': scrolled}]">
<div class="bd-modal-inner">
<div class="bd-modal-header">
<span class="bd-modal-headertext">{{headerText}}</span>
@ -19,7 +19,7 @@
</div>
<div class="bd-modal-body">
<div class="bd-scroller-wrap">
<div class="bd-scroller">
<div class="bd-scroller" @scroll="e => scrolled = e.target.scrollTop !== 0">
<slot name="body"></slot>
</div>
</div>
@ -39,6 +39,24 @@
props: ['headerText', 'close'],
components: {
MiClose
},
data() {
return {
scrolled: false
};
},
beforeMount() {
window.addEventListener('keyup', this.keyupListener);
},
destroyed() {
window.removeEventListener('keyup', this.keyupListener);
},
methods: {
keyupListener(e) {
if (e.which === 27) {
this.close();
}
}
}
}
</script>

View File

@ -10,14 +10,16 @@
<template>
<div class="bd-setting-switch" :class="{'bd-disabled': disabled}">
<div class="bd-title">
<h3>{{setting.title || setting.text}}</h3>
<label class="bd-switch-wrapper" @click="!disabled ? onClick(setting) : null">
<input type="checkbox" class="bd-switch-checkbox" />
<div class="bd-switch" :class="{'bd-checked': (setting.checked || setting.enabled || setting.value)}" />
</label>
<div class="bd-setting-switch-wrap">
<div class="bd-title">
<h3>{{setting.title || setting.text}}</h3>
<label class="bd-switch-wrapper" @click="!disabled ? onClick(setting) : null">
<input type="checkbox" class="bd-switch-checkbox" />
<div class="bd-switch" :class="{'bd-checked': (setting.checked || setting.enabled || setting.value)}" />
</label>
</div>
<div class="bd-hint">{{setting.hint}}</div>
</div>
<div class="bd-hint">{{setting.hint}}</div>
</div>
</template>
<script>

View File

@ -0,0 +1,27 @@
/**
* BetterDiscord Material Design Icon
* 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.
*
* Material Design Icons
* Copyright (c) 2014 Google
* Apache 2.0 LICENSE
* https://www.apache.org/licenses/LICENSE-2.0.txt
*/
<template>
<span class="bd-material-design-icon">
<svg :width="size || 24" :height="size || 24" viewBox="0 0 24 24">
<path d="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z" />
</svg>
</span>
</template>
<script>
export default {
props: ['size']
}
</script>