mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
* add colors palette * add secondary menu component and style it * add box shadow to secondary menu * misc css, fixes for secondary menu * client: add equipment page with grouping, css: add some styles * add typography * more equipment * stable: fix linting * equipment: add styles (lots of general styles too) * remove duplicate google fonts loading * add dropdowns * design: white search input background, remove gray from items * start adding drawer and selected indicator * wip equipment * fix equipment * equipment: correctly bind new properties on items.gear.equipped * equipment: fix vue binding. version 2 * equipment: fix vue binding. version 3 * back to first fix for equip op, fix for sourcemaps, send http request when an item is equipped, load bootstrap-vue components where needed * checkboxes and radio buttons * correctly renders selected items in first postion during the first render * add search * general changes, constants part of app state, add popovers * add toggle switch, rename css * correct offset * upgrade deps * upgrade deps * drawer and lot of other work * update equipping mechanism * finish equipment * fix compilation and upgrade deps * use v-show in place of v-if to fix ui issues * v-show -> v-if * fix linting in test/client * fix es6 compilation in test/client * fix babel compilation for tests * fix groupsUtilities mixin tests * client: buttons * client: buttons: fix colors * client: finish buttons and dropdowns * upgrade bootstrap-vue, finish buttons and dropdowns * fix tasks page layout * misc fixes for buttons * add textareas * fix app menu * add inputs * fixes for toggleSwitch * typography * checkboxes and radio buttons * add checkbox icon * fix equip.js * extract strings to newClient.json * add Popover above 'Use Costume' / 'Auto Equip' slider - disable item select if costume-mode and 'useCostume' isn't active * show "you have disabled your costume" error above the drawer items * check errorMessage for null * hide star if costume not enabled * fix errorMessage (!errorMessage seems not to work for string) * show minimize / expand icon - always centered by css * drawer test * drawer: fix centering on large screens * fix show more button * add margin when two dropdowns are next to each other * adjust the page padding based on the drawer, misc fixes * drawer fixes
160 lines
3.2 KiB
Vue
160 lines
3.2 KiB
Vue
<template lang="pug">
|
|
.drawer-container
|
|
.drawer-title(@click="open = !open")
|
|
| {{title}}
|
|
img.drawer-toggle-icon(src="~assets/drawer/minimize.svg", v-if="open")
|
|
img.drawer-toggle-icon.closed(src="~assets/drawer/expand.svg", v-else)
|
|
transition(name="slide-up", @afterLeave="adjustPagePadding", @afterEnter="adjustPagePadding")
|
|
.drawer-content(v-show="open")
|
|
slot(name="drawer-header")
|
|
.drawer-slider
|
|
slot(name="drawer-slider")
|
|
div.message(v-if="errorMessage != null")
|
|
.content {{ errorMessage }}
|
|
</template>
|
|
|
|
<style lang="scss">
|
|
@import '~client/assets/scss/colors.scss';
|
|
|
|
.drawer-container {
|
|
z-index: 19;
|
|
position: fixed;
|
|
font-size: 12px;
|
|
font-weight: bold;
|
|
bottom: 0;
|
|
left: 19%;
|
|
right: 3%;
|
|
max-width: 80%;
|
|
|
|
@media screen and (min-width: 1241px) {
|
|
max-width: 968px;
|
|
// 16.67% is the width of the .col-2 sidebar
|
|
left: calc((100% + 16.67% - 968px) / 2);
|
|
right: 0%;
|
|
}
|
|
}
|
|
|
|
.drawer-toggle-icon {
|
|
float: right;
|
|
margin: 10px;
|
|
|
|
&.closed {
|
|
margin-top: 5px;
|
|
}
|
|
}
|
|
|
|
.drawer-title {
|
|
background-color: $gray-10;
|
|
box-shadow: 0 1px 2px 0 rgba($black, 0.2);
|
|
cursor: pointer;
|
|
border-top-right-radius: 8px;
|
|
border-top-left-radius: 8px;
|
|
text-align: center;
|
|
line-height: 1.67;
|
|
color: $white;
|
|
padding: 6px 0;
|
|
}
|
|
|
|
.drawer-content {
|
|
line-height: 1.33;
|
|
max-height: 300px;
|
|
background-color: $gray-50;
|
|
color: $gray-500;
|
|
box-shadow: 0 2px 16px 0 rgba($black, 0.3);
|
|
padding-top: 6px;
|
|
padding-left: 24px;
|
|
padding-right: 24px;
|
|
}
|
|
|
|
.drawer-tab {
|
|
&-container {
|
|
display: flex;
|
|
margin-left: 24px;
|
|
|
|
& > div {
|
|
flex: 1;
|
|
}
|
|
}
|
|
|
|
&-text {
|
|
font-size: 12px;
|
|
font-weight: bold;
|
|
line-height: 1.67;
|
|
text-align: center;
|
|
color: $white;
|
|
border-bottom: 2px solid transparent;
|
|
padding: 0px 8px 8px 8px;
|
|
|
|
&-active {
|
|
border-color: $purple-400;
|
|
}
|
|
}
|
|
}
|
|
|
|
.drawer-slider {
|
|
padding: 12px 0 0 24px;
|
|
margin-left: -24px;
|
|
overflow-x: auto;
|
|
overflow-y: hidden;
|
|
white-space: nowrap;
|
|
position: relative;
|
|
|
|
& .message {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
|
|
top: calc(50% - 30px);
|
|
left: 24px;
|
|
right: 0;
|
|
position: absolute;
|
|
|
|
& .content {
|
|
background-color: rgba($gray-200, 0.5);
|
|
border-radius: 8px;
|
|
padding: 12px;
|
|
}
|
|
}
|
|
}
|
|
|
|
.slide-up-enter-active, .slide-up-leave-active {
|
|
transition-property: all;
|
|
transition-duration: 450ms;
|
|
transition-timing-function: cubic-bezier(0.445, 0.05, 0.55, 0.95);
|
|
}
|
|
.slide-up-enter, .slide-up-leave-to {
|
|
max-height: 0;
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
export default {
|
|
props: {
|
|
title: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
errorMessage: {
|
|
type: String,
|
|
},
|
|
},
|
|
data () {
|
|
return {
|
|
open: true,
|
|
};
|
|
},
|
|
methods: {
|
|
adjustPagePadding () {
|
|
let minPaddingBottom = 20;
|
|
let drawerHeight = this.$el.offsetHeight;
|
|
let standardPage = document.getElementsByClassName('standard-page')[0];
|
|
standardPage.style.paddingBottom = `${drawerHeight + minPaddingBottom}px`;
|
|
},
|
|
},
|
|
mounted () {
|
|
// Make sure the page has enough space so the drawer does not overlap content
|
|
this.adjustPagePadding();
|
|
},
|
|
};
|
|
</script>
|