mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
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:
@@ -154,6 +154,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
.show > .btn-secondary.dropdown-toggle:not(.btn-success):not(:disabled):not(.disabled) {
|
||||
--icon-color: #{$purple-300};
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
background: $maroon-100;
|
||||
border: 1px solid transparent;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
}
|
||||
|
||||
.dropdown-toggle:hover {
|
||||
--caret-color: #{$purple-200};
|
||||
--caret-color: #{$purple-300};
|
||||
}
|
||||
|
||||
.dropdown.show > .dropdown-toggle:not(.btn-success) {
|
||||
@@ -15,7 +15,7 @@
|
||||
box-shadow: none;
|
||||
|
||||
&::after {
|
||||
--caret-color: #{$purple-200};
|
||||
--caret-color: #{$purple-300};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,10 +55,14 @@
|
||||
|
||||
|
||||
&:active, &:hover, &:focus, &.active {
|
||||
background-color: rgba($purple-600, 0.25) !important;
|
||||
background-color: inherit !important;
|
||||
color: $purple-300 !important;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: rgba($purple-600, 0.25) !important;
|
||||
}
|
||||
|
||||
&.dropdown-inactive {
|
||||
cursor: default;
|
||||
|
||||
@@ -126,7 +130,10 @@
|
||||
height: 32px;
|
||||
|
||||
&:active, &:hover, &:focus, &.active {
|
||||
background-color: rgba($purple-600, 0.25);
|
||||
color: $purple-300;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: rgba($purple-600, 0.25);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,23 +53,22 @@
|
||||
/>
|
||||
|
||||
<span class="dropdown-label">{{ $t('groupBy2') }}</span>
|
||||
<b-dropdown
|
||||
:text="$t(groupBy === 'type' ? 'equipmentType' : 'class')"
|
||||
right="right"
|
||||
|
||||
<select-list
|
||||
: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
|
||||
:active="groupBy === 'type'"
|
||||
@click="groupBy = 'type'"
|
||||
>
|
||||
{{ $t('equipmentType') }}
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item
|
||||
:active="groupBy === 'class'"
|
||||
@click="groupBy = 'class'"
|
||||
>
|
||||
{{ $t('class') }}
|
||||
</b-dropdown-item>
|
||||
</b-dropdown>
|
||||
<template v-slot:item="{ item }">
|
||||
<span class="label">{{ groupByLabel(item) }}</span>
|
||||
</template>
|
||||
</select-list>
|
||||
|
||||
<span class="divider"></span>
|
||||
<unequip-dropdown />
|
||||
@@ -311,6 +310,7 @@ import Checkbox from '@/components/ui/checkbox';
|
||||
import UnequipDropdown from '@/components/inventory/equipment/unequipDropdown';
|
||||
import EquipBadge from '@/components/ui/equipBadge';
|
||||
import SelectTranslatedArray from '@/components/tasks/modal-controls/selectTranslatedArray';
|
||||
import SelectList from '@/components/ui/selectList';
|
||||
|
||||
const sortGearTypes = ['sortByName', 'sortByCon', 'sortByPer', 'sortByStr', 'sortByInt'];
|
||||
|
||||
@@ -325,6 +325,7 @@ const sortGearTypeMap = {
|
||||
export default {
|
||||
name: 'Equipment',
|
||||
components: {
|
||||
SelectList,
|
||||
SelectTranslatedArray,
|
||||
EquipBadge,
|
||||
UnequipDropdown,
|
||||
@@ -344,6 +345,9 @@ export default {
|
||||
searchText: null,
|
||||
searchTextThrottled: null,
|
||||
costumeMode: false,
|
||||
groupByItems: [
|
||||
'type', 'class',
|
||||
],
|
||||
groupBy: 'type', // or 'class'
|
||||
gearTypesToStrings: Object.freeze({ // TODO use content.itemList?
|
||||
weapon: i18n.t('weaponCapitalized'),
|
||||
@@ -575,6 +579,13 @@ export default {
|
||||
CONSTANTS.drawerStateValues.DRAWER_CLOSED,
|
||||
);
|
||||
},
|
||||
groupByLabel (type) {
|
||||
switch (type) {
|
||||
case 'type': return i18n.t('equipmentType');
|
||||
case 'class': return i18n.t('class');
|
||||
default: return '';
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -122,19 +122,14 @@
|
||||
<div class="clearfix">
|
||||
<div class="float-right">
|
||||
<span class="dropdown-label">{{ $t('sortBy') }}</span>
|
||||
<b-dropdown
|
||||
:text="$t(selectedSortItemsBy)"
|
||||
right="right"
|
||||
>
|
||||
<b-dropdown-item
|
||||
v-for="sort in sortItemsBy"
|
||||
:key="sort"
|
||||
:active="selectedSortItemsBy === sort"
|
||||
@click="selectedSortItemsBy = sort"
|
||||
>
|
||||
{{ $t(sort) }}
|
||||
</b-dropdown-item>
|
||||
</b-dropdown>
|
||||
<select-translated-array
|
||||
:right="true"
|
||||
:value="selectedSortItemsBy"
|
||||
:items="sortItemsBy"
|
||||
:inline-dropdown="false"
|
||||
class="inline"
|
||||
@select="selectedSortItemsBy = $event"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 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 isPinned from '@/../../common/script/libs/isPinned';
|
||||
import SelectTranslatedArray from '@/components/tasks/modal-controls/selectTranslatedArray';
|
||||
|
||||
|
||||
export default {
|
||||
components: {
|
||||
SelectTranslatedArray,
|
||||
ShopItem,
|
||||
Item,
|
||||
CountBadge,
|
||||
|
||||
@@ -138,19 +138,14 @@
|
||||
</h2>
|
||||
<div class="float-right">
|
||||
<span class="dropdown-label">{{ $t('sortBy') }}</span>
|
||||
<b-dropdown
|
||||
:text="$t(selectedSortItemsBy)"
|
||||
right="right"
|
||||
>
|
||||
<b-dropdown-item
|
||||
v-for="sort in sortItemsBy"
|
||||
:key="sort"
|
||||
:active="selectedSortItemsBy === sort"
|
||||
@click="selectedSortItemsBy = sort"
|
||||
>
|
||||
{{ $t(sort) }}
|
||||
</b-dropdown-item>
|
||||
</b-dropdown>
|
||||
<select-translated-array
|
||||
:right="true"
|
||||
:value="selectedSortItemsBy"
|
||||
:items="sortItemsBy"
|
||||
:inline-dropdown="false"
|
||||
class="inline"
|
||||
@select="selectedSortItemsBy = $event"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
@@ -394,9 +389,11 @@ import getOfficialPinnedItems from '@/../../common/script/libs/getOfficialPinned
|
||||
import i18n from '@/../../common/script/i18n';
|
||||
|
||||
import shops from '@/../../common/script/libs/shops';
|
||||
import SelectTranslatedArray from '@/components/tasks/modal-controls/selectTranslatedArray';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
SelectTranslatedArray,
|
||||
Checkbox,
|
||||
PinBadge,
|
||||
ShopItem,
|
||||
|
||||
@@ -78,19 +78,15 @@
|
||||
class="clearfix"
|
||||
>
|
||||
<div class="float-right">
|
||||
<span class="dropdown-label">{{ $t('sortBy') }}</span><b-dropdown
|
||||
:text="$t(selectedSortItemsBy)"
|
||||
right="right"
|
||||
>
|
||||
<b-dropdown-item
|
||||
v-for="sort in sortItemsBy"
|
||||
:key="sort"
|
||||
:active="selectedSortItemsBy === sort"
|
||||
@click="selectedSortItemsBy = sort"
|
||||
>
|
||||
{{ $t(sort) }}
|
||||
</b-dropdown-item>
|
||||
</b-dropdown>
|
||||
<span class="dropdown-label">{{ $t('sortBy') }}</span>
|
||||
<select-translated-array
|
||||
:right="true"
|
||||
:value="selectedSortItemsBy"
|
||||
:items="sortItemsBy"
|
||||
:inline-dropdown="false"
|
||||
class="inline"
|
||||
@select="selectedSortItemsBy = $event"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 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 pinUtils from '@/mixins/pinUtils';
|
||||
import SelectTranslatedArray from '@/components/tasks/modal-controls/selectTranslatedArray';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
SelectTranslatedArray,
|
||||
ShopItem,
|
||||
Item,
|
||||
ItemRows,
|
||||
|
||||
@@ -1,35 +1,31 @@
|
||||
<template>
|
||||
<span>
|
||||
<span class="dropdown-label">{{ label }}</span>
|
||||
<b-dropdown right="right">
|
||||
<span
|
||||
slot="button-content"
|
||||
:class="{'dropdown-icon-item': withIcon}"
|
||||
>
|
||||
<slot
|
||||
name="item"
|
||||
:item="selectedItem"
|
||||
></slot>
|
||||
</span>
|
||||
<b-dropdown-item
|
||||
v-for="item in items"
|
||||
:key="item.id"
|
||||
:active="selectedItem.id === item.id"
|
||||
@click="selectItem(item)"
|
||||
>
|
||||
<select-list :items="items"
|
||||
:value="selectedItem"
|
||||
class="array-select inline"
|
||||
:right="true"
|
||||
key-prop="id"
|
||||
:hide-icon="false"
|
||||
:inline-dropdown="false"
|
||||
@select="selectItem($event)">
|
||||
<template v-slot:item="{ item }">
|
||||
<span :class="{'dropdown-icon-item': withIcon}">
|
||||
<slot
|
||||
name="item"
|
||||
:item="item"
|
||||
></slot>
|
||||
</span>
|
||||
</b-dropdown-item>
|
||||
</b-dropdown>
|
||||
</template>
|
||||
</select-list>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SelectList from '@/components/ui/selectList';
|
||||
|
||||
export default {
|
||||
components: { SelectList },
|
||||
props: {
|
||||
label: String,
|
||||
items: Array,
|
||||
|
||||
Reference in New Issue
Block a user