update dropdowns to use the updated / styled components (#12758)

* update dropdowns to use the updated / styled components

* update colors / behavior for colors

* remove class binding
This commit is contained in:
negue
2020-11-09 22:26:21 +01:00
committed by GitHub
parent 27129754cd
commit f2c6838e95
7 changed files with 88 additions and 78 deletions

View File

@@ -154,6 +154,10 @@
} }
} }
.show > .btn-secondary.dropdown-toggle:not(.btn-success):not(:disabled):not(.disabled) {
--icon-color: #{$purple-300};
}
.btn-danger { .btn-danger {
background: $maroon-100; background: $maroon-100;
border: 1px solid transparent; border: 1px solid transparent;

View File

@@ -6,7 +6,7 @@
} }
.dropdown-toggle:hover { .dropdown-toggle:hover {
--caret-color: #{$purple-200}; --caret-color: #{$purple-300};
} }
.dropdown.show > .dropdown-toggle:not(.btn-success) { .dropdown.show > .dropdown-toggle:not(.btn-success) {
@@ -15,7 +15,7 @@
box-shadow: none; box-shadow: none;
&::after { &::after {
--caret-color: #{$purple-200}; --caret-color: #{$purple-300};
} }
} }
@@ -55,10 +55,14 @@
&:active, &:hover, &:focus, &.active { &:active, &:hover, &:focus, &.active {
background-color: rgba($purple-600, 0.25) !important; background-color: inherit !important;
color: $purple-300 !important; color: $purple-300 !important;
} }
&:hover {
background-color: rgba($purple-600, 0.25) !important;
}
&.dropdown-inactive { &.dropdown-inactive {
cursor: default; cursor: default;
@@ -126,7 +130,10 @@
height: 32px; height: 32px;
&:active, &:hover, &:focus, &.active { &:active, &:hover, &:focus, &.active {
background-color: rgba($purple-600, 0.25);
color: $purple-300; color: $purple-300;
} }
&:hover {
background-color: rgba($purple-600, 0.25);
}
} }

View File

@@ -53,23 +53,22 @@
/> />
<span class="dropdown-label">{{ $t('groupBy2') }}</span> <span class="dropdown-label">{{ $t('groupBy2') }}</span>
<b-dropdown
:text="$t(groupBy === 'type' ? 'equipmentType' : 'class')" <select-list
right="right" :items="groupByItems"
:value="groupBy"
class="array-select"
:class="{disabled: disabled}"
:disabled="disabled"
:right="true"
:hide-icon="false"
:inline-dropdown="false"
@select="groupBy = $event"
> >
<b-dropdown-item <template v-slot:item="{ item }">
:active="groupBy === 'type'" <span class="label">{{ groupByLabel(item) }}</span>
@click="groupBy = 'type'" </template>
> </select-list>
{{ $t('equipmentType') }}
</b-dropdown-item>
<b-dropdown-item
:active="groupBy === 'class'"
@click="groupBy = 'class'"
>
{{ $t('class') }}
</b-dropdown-item>
</b-dropdown>
<span class="divider"></span> <span class="divider"></span>
<unequip-dropdown /> <unequip-dropdown />
@@ -311,6 +310,7 @@ import Checkbox from '@/components/ui/checkbox';
import UnequipDropdown from '@/components/inventory/equipment/unequipDropdown'; import UnequipDropdown from '@/components/inventory/equipment/unequipDropdown';
import EquipBadge from '@/components/ui/equipBadge'; import EquipBadge from '@/components/ui/equipBadge';
import SelectTranslatedArray from '@/components/tasks/modal-controls/selectTranslatedArray'; import SelectTranslatedArray from '@/components/tasks/modal-controls/selectTranslatedArray';
import SelectList from '@/components/ui/selectList';
const sortGearTypes = ['sortByName', 'sortByCon', 'sortByPer', 'sortByStr', 'sortByInt']; const sortGearTypes = ['sortByName', 'sortByCon', 'sortByPer', 'sortByStr', 'sortByInt'];
@@ -325,6 +325,7 @@ const sortGearTypeMap = {
export default { export default {
name: 'Equipment', name: 'Equipment',
components: { components: {
SelectList,
SelectTranslatedArray, SelectTranslatedArray,
EquipBadge, EquipBadge,
UnequipDropdown, UnequipDropdown,
@@ -344,6 +345,9 @@ export default {
searchText: null, searchText: null,
searchTextThrottled: null, searchTextThrottled: null,
costumeMode: false, costumeMode: false,
groupByItems: [
'type', 'class',
],
groupBy: 'type', // or 'class' groupBy: 'type', // or 'class'
gearTypesToStrings: Object.freeze({ // TODO use content.itemList? gearTypesToStrings: Object.freeze({ // TODO use content.itemList?
weapon: i18n.t('weaponCapitalized'), weapon: i18n.t('weaponCapitalized'),
@@ -575,6 +579,13 @@ export default {
CONSTANTS.drawerStateValues.DRAWER_CLOSED, CONSTANTS.drawerStateValues.DRAWER_CLOSED,
); );
}, },
groupByLabel (type) {
switch (type) {
case 'type': return i18n.t('equipmentType');
case 'class': return i18n.t('class');
default: return '';
}
},
}, },
}; };
</script> </script>

View File

@@ -122,19 +122,14 @@
<div class="clearfix"> <div class="clearfix">
<div class="float-right"> <div class="float-right">
<span class="dropdown-label">{{ $t('sortBy') }}</span> <span class="dropdown-label">{{ $t('sortBy') }}</span>
<b-dropdown <select-translated-array
:text="$t(selectedSortItemsBy)" :right="true"
right="right" :value="selectedSortItemsBy"
> :items="sortItemsBy"
<b-dropdown-item :inline-dropdown="false"
v-for="sort in sortItemsBy" class="inline"
:key="sort" @select="selectedSortItemsBy = $event"
:active="selectedSortItemsBy === sort" />
@click="selectedSortItemsBy = sort"
>
{{ $t(sort) }}
</b-dropdown-item>
</b-dropdown>
</div> </div>
</div> </div>
<!-- eslint-disable vue/no-use-v-if-with-v-for --> <!-- eslint-disable vue/no-use-v-if-with-v-for -->
@@ -474,10 +469,12 @@ import QuestInfo from './questInfo.vue';
import shops from '@/../../common/script/libs/shops'; import shops from '@/../../common/script/libs/shops';
import isPinned from '@/../../common/script/libs/isPinned'; import isPinned from '@/../../common/script/libs/isPinned';
import SelectTranslatedArray from '@/components/tasks/modal-controls/selectTranslatedArray';
export default { export default {
components: { components: {
SelectTranslatedArray,
ShopItem, ShopItem,
Item, Item,
CountBadge, CountBadge,

View File

@@ -138,19 +138,14 @@
</h2> </h2>
<div class="float-right"> <div class="float-right">
<span class="dropdown-label">{{ $t('sortBy') }}</span> <span class="dropdown-label">{{ $t('sortBy') }}</span>
<b-dropdown <select-translated-array
:text="$t(selectedSortItemsBy)" :right="true"
right="right" :value="selectedSortItemsBy"
> :items="sortItemsBy"
<b-dropdown-item :inline-dropdown="false"
v-for="sort in sortItemsBy" class="inline"
:key="sort" @select="selectedSortItemsBy = $event"
:active="selectedSortItemsBy === sort" />
@click="selectedSortItemsBy = sort"
>
{{ $t(sort) }}
</b-dropdown-item>
</b-dropdown>
</div> </div>
</div> </div>
<div <div
@@ -394,9 +389,11 @@ import getOfficialPinnedItems from '@/../../common/script/libs/getOfficialPinned
import i18n from '@/../../common/script/i18n'; import i18n from '@/../../common/script/i18n';
import shops from '@/../../common/script/libs/shops'; import shops from '@/../../common/script/libs/shops';
import SelectTranslatedArray from '@/components/tasks/modal-controls/selectTranslatedArray';
export default { export default {
components: { components: {
SelectTranslatedArray,
Checkbox, Checkbox,
PinBadge, PinBadge,
ShopItem, ShopItem,

View File

@@ -78,19 +78,15 @@
class="clearfix" class="clearfix"
> >
<div class="float-right"> <div class="float-right">
<span class="dropdown-label">{{ $t('sortBy') }}</span><b-dropdown <span class="dropdown-label">{{ $t('sortBy') }}</span>
:text="$t(selectedSortItemsBy)" <select-translated-array
right="right" :right="true"
> :value="selectedSortItemsBy"
<b-dropdown-item :items="sortItemsBy"
v-for="sort in sortItemsBy" :inline-dropdown="false"
:key="sort" class="inline"
:active="selectedSortItemsBy === sort" @select="selectedSortItemsBy = $event"
@click="selectedSortItemsBy = sort" />
>
{{ $t(sort) }}
</b-dropdown-item>
</b-dropdown>
</div> </div>
</div> </div>
<!-- eslint-disable vue/no-use-v-if-with-v-for --> <!-- eslint-disable vue/no-use-v-if-with-v-for -->
@@ -301,9 +297,11 @@ import isPinned from '@/../../common/script/libs/isPinned';
import shops from '@/../../common/script/libs/shops'; import shops from '@/../../common/script/libs/shops';
import pinUtils from '@/mixins/pinUtils'; import pinUtils from '@/mixins/pinUtils';
import SelectTranslatedArray from '@/components/tasks/modal-controls/selectTranslatedArray';
export default { export default {
components: { components: {
SelectTranslatedArray,
ShopItem, ShopItem,
Item, Item,
ItemRows, ItemRows,

View File

@@ -1,35 +1,31 @@
<template> <template>
<span> <span>
<span class="dropdown-label">{{ label }}</span> <span class="dropdown-label">{{ label }}</span>
<b-dropdown right="right"> <select-list :items="items"
<span :value="selectedItem"
slot="button-content" class="array-select inline"
:class="{'dropdown-icon-item': withIcon}" :right="true"
> key-prop="id"
<slot :hide-icon="false"
name="item" :inline-dropdown="false"
:item="selectedItem" @select="selectItem($event)">
></slot> <template v-slot:item="{ item }">
</span>
<b-dropdown-item
v-for="item in items"
:key="item.id"
:active="selectedItem.id === item.id"
@click="selectItem(item)"
>
<span :class="{'dropdown-icon-item': withIcon}"> <span :class="{'dropdown-icon-item': withIcon}">
<slot <slot
name="item" name="item"
:item="item" :item="item"
></slot> ></slot>
</span> </span>
</b-dropdown-item> </template>
</b-dropdown> </select-list>
</span> </span>
</template> </template>
<script> <script>
import SelectList from '@/components/ui/selectList';
export default { export default {
components: { SelectList },
props: { props: {
label: String, label: String,
items: Array, items: Array,