Files
habitica/website/client/components/ui/customMenuDropdown.vue
negue 4108a22d78 [WIP] bootstrap-vue upgrade (#9178)
* update bootstrap-vue to 1.0.0-beta.9 - remove all individual bootstrap components and use BootstrapVue into Vue

* change modal action names from show::modal to bv::show::modal

* check if drops are undefined

* fix modal widths - sellModal now using input instead of dropbox

* upgrade to bootstrap 4.0beta

* include package-lock changes

* fix app menu dropdown position

* upgrade bootstrap to beta2 (was missing grid offset and other fixes) - refix header menu position

* fix tags popup (auto width to max not working) - fix filter panel width (adding width: 100% works until max-width)

* show hide logo on different screensize (new css breakpoints - http://getbootstrap.com/docs/4.0/utilities/display/ )

* fix package-lock?

* fix active button style / app header toggle button

* fix package-lock !

* update package lock after merge - new mixin "openedItemRows" to save the "show more/show less" in stable

* mixin naming style

* fix buyQuestModal marginTop

* fix customMenuDropdown position

* fix userDropdown items
2017-11-08 18:40:37 +01:00

78 lines
1.6 KiB
Vue

<!--
A simplified dropdown component that doesn't rely on buttons as toggles like bootstrap-vue
-->
<template lang="pug">
.habitica-menu-dropdown.item-with-icon.dropdown(@click="toggleDropdown()", :class="{open: isDropdownOpen}")
.habitica-menu-dropdown-toggle
slot(name="dropdown-toggle")
.dropdown-menu(:class="{'dropdown-menu-right': right}")
slot(name="dropdown-content")
</template>
<style lang="scss">
@import '~client/assets/scss/colors.scss';
.habitica-menu-dropdown.open {
.habitica-menu-dropdown-toggle .svg-icon {
color: $white !important;
}
}
</style>
<style lang='scss' scoped>
@import '~client/assets/scss/colors.scss';
.dropdown {
&:hover {
cursor: pointer;
}
.dropdown-menu {
cursor: auto;
box-shadow: 0 2px 2px 0 rgba($black, 0.16), 0 1px 4px 0 rgba($black, 0.12);
max-height: calc(100vh - 100px);
overflow: auto;
left: inherit;
right: 0px !important;
/deep/ .dropdown-separated {
border-bottom: 1px solid $gray-500;
}
}
&.open {
.dropdown-menu {
display: block;
margin-top: 16px;
}
}
}
</style>
<script>
export default {
props: ['right'],
data () {
return {
isDropdownOpen: false,
};
},
mounted () {
document.documentElement.addEventListener('click', this._clickOutListener);
},
destroyed () {
document.removeEventListener('click', this._clickOutListener);
},
methods: {
_clickOutListener (e) {
if (!this.$el.contains(e.target) && this.isDropdownOpen) {
this.toggleDropdown();
}
},
toggleDropdown () {
this.isDropdownOpen = !this.isDropdownOpen;
},
},
};
</script>