Apply Dropdown Styles to various parts (#12814)

* membersModal use the new select component instead of html select

* update dropdown styles on challengeDetail (add task) and on inventory unequip

* change the width to "min-width"
This commit is contained in:
negue
2020-11-30 20:01:22 +01:00
committed by GitHub
parent 51b50bfa3c
commit d3eb9fe230
5 changed files with 49 additions and 31 deletions

View File

@@ -120,7 +120,7 @@
} }
.dropdown-menu.show { .dropdown-menu.show {
width: 100% !important; min-width: 100% !important;
} }
} }

View File

@@ -99,11 +99,12 @@
<div class="col-12 col-md-6 text-right"> <div class="col-12 col-md-6 text-right">
<span v-if="isLeader || isAdmin"> <span v-if="isLeader || isAdmin">
<b-dropdown <b-dropdown
class="create-dropdown" class="create-dropdown select-list"
:text="$t('addTaskToChallenge')" :text="$t('addTaskToChallenge')"
:variant="'success'" :variant="'success'"
> >
<b-dropdown-item <b-dropdown-item
class="selectListItem"
v-for="type in columns" v-for="type in columns"
:key="type" :key="type"
@click="createTask(type)" @click="createTask(type)"

View File

@@ -43,32 +43,25 @@
> >
</div> </div>
<div class="col"> <div class="col">
<select <select-list :items="sortOptions"
class="form-control" @select="changeSortOption($event)"
@change="changeSortOption($event)" :value="optionEntryBySelectedValue"
> key-prop="value">
<option <template v-slot:item="{ item }">
v-for="sortOption in sortOptions" <span class="label" v-if="item">{{ item.text }}</span>
:key="sortOption.value" </template>
:value="sortOption.value" </select-list>
>
{{ sortOption.text }}
</option>
</select>
</div> </div>
<div class="col-3"> <div class="col-3">
<select
class="form-control" <select-list :items="sortDirections"
@change="changeSortDirection($event)" @select="changeSortDirection($event)"
> :value="directionEntryBySelectedValue"
<option key-prop="value">
v-for="sortDirection in sortDirections" <template v-slot:item="{ item }">
:key="sortDirection.value" <span class="label" v-if="item">{{ item.text }}</span>
:value="sortDirection.value" </template>
> </select-list>
{{ sortDirection.text }}
</option>
</select>
</div> </div>
</div> </div>
</div> </div>
@@ -386,9 +379,11 @@ import blockIcon from '@/assets/svg/block.svg';
import messageIcon from '@/assets/members/message.svg'; import messageIcon from '@/assets/members/message.svg';
import starIcon from '@/assets/members/star.svg'; import starIcon from '@/assets/members/star.svg';
import dots from '@/assets/svg/dots.svg'; import dots from '@/assets/svg/dots.svg';
import SelectList from '@/components/ui/selectList';
export default { export default {
components: { components: {
SelectList,
MemberDetails, MemberDetails,
removeMemberModal, removeMemberModal,
loadingGryphon, loadingGryphon,
@@ -396,7 +391,11 @@ export default {
props: ['hideBadge'], props: ['hideBadge'],
data () { data () {
return { return {
sortOption: {}, sortOption: {
// default sort options
value: 'stats.class',
direction: 'asc',
},
sortDirty: false, sortDirty: false,
selectedPage: 'members', selectedPage: 'members',
members: [], members: [],
@@ -509,6 +508,12 @@ export default {
return sortedMembers; return sortedMembers;
}, },
optionEntryBySelectedValue () {
return this.sortOptions.find(o => o.value === this.sortOption.value);
},
directionEntryBySelectedValue () {
return this.sortDirections.find(o => o.value === this.sortOption.direction);
},
}, },
watch: { watch: {
// Watches `searchTerm` and if present, performs a `searchMembers` action // Watches `searchTerm` and if present, performs a `searchMembers` action
@@ -620,11 +625,11 @@ export default {
this.$root.$emit('bv::hide::modal', 'members-modal'); this.$root.$emit('bv::hide::modal', 'members-modal');
}, },
changeSortOption (e) { changeSortOption (e) {
this.sortOption.value = e.target.value; this.sortOption.value = e.value;
this.sort(); this.sort();
}, },
changeSortDirection (e) { changeSortDirection (e) {
this.sortOption.direction = e.target.value; this.sortOption.direction = e.value;
this.sort(); this.sort();
}, },
sort () { sort () {

View File

@@ -63,8 +63,6 @@
:items="groupByItems" :items="groupByItems"
:value="groupBy" :value="groupBy"
class="array-select" class="array-select"
:class="{disabled: disabled}"
:disabled="disabled"
:right="true" :right="true"
:hide-icon="false" :hide-icon="false"
:inline-dropdown="false" :inline-dropdown="false"

View File

@@ -1,5 +1,6 @@
<template> <template>
<b-dropdown <b-dropdown
class="select-list"
right="right" right="right"
toggle-class="with-icon" toggle-class="with-icon"
> >
@@ -15,26 +16,31 @@
>{{ $t('unequip') }}</span> >{{ $t('unequip') }}</span>
</template> </template>
<b-dropdown-item <b-dropdown-item
class="selectListItem"
@click="unequipBattleGear()" @click="unequipBattleGear()"
> >
{{ $t('battleGear') }} {{ $t('battleGear') }}
</b-dropdown-item> </b-dropdown-item>
<b-dropdown-item <b-dropdown-item
class="selectListItem"
@click="unequipCostume()" @click="unequipCostume()"
> >
{{ $t('costume') }} {{ $t('costume') }}
</b-dropdown-item> </b-dropdown-item>
<b-dropdown-item <b-dropdown-item
class="selectListItem"
@click="unequipPetMount()" @click="unequipPetMount()"
> >
{{ $t('petAndMount') }} {{ $t('petAndMount') }}
</b-dropdown-item> </b-dropdown-item>
<b-dropdown-item <b-dropdown-item
class="selectListItem"
@click="unequipBackground()" @click="unequipBackground()"
> >
{{ $t('background') }} {{ $t('background') }}
</b-dropdown-item> </b-dropdown-item>
<b-dropdown-item <b-dropdown-item
class="selectListItem"
@click="unequipAllItems()" @click="unequipAllItems()"
> >
{{ $t('allItems') }} {{ $t('allItems') }}
@@ -100,6 +106,14 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
@import '~@/assets/scss/colors.scss'; @import '~@/assets/scss/colors.scss';
.select-list {
::v-deep {
.dropdown-menu {
min-width: 8rem; // instead of the normal 10
}
}
}
::v-deep { ::v-deep {
.btn { .btn {
display: flex; display: flex;