habitica/website/client/src/components/avatarModal/customize-options.vue
Sabe Jones 271f40e355 Squashed commit of the following:
commit 8ed95731cb5871bff7f1d0e9ab25b8cf9043ff7c
Author: Phillip Thelen <phillip@habitica.com>
Date:   Tue Jul 23 17:59:56 2024 +0200

    fix hatched dialog

commit 53242ad96c5bf3171af7e96ef93d26c9c47e1211
Author: Phillip Thelen <phillip@habitica.com>
Date:   Tue Jul 23 17:38:13 2024 +0200

    fix popover not showing

commit ce4bfd25bdd9e62cc105b7023f66f4da9d1ef41d
Author: Phillip Thelen <phillip@habitica.com>
Date:   Wed Jul 3 17:28:30 2024 +0200

    move item popover to own component

commit 2e6a300c462b73c992c7b19b13d0a7a453b62c09
Author: Phillip Thelen <phillip@habitica.com>
Date:   Mon Jul 1 18:48:24 2024 +0200

    make scaled sprites look nice

commit a3cbadb8c2a2ba9ea9f73247f62142a2f34f27ed
Author: Phillip Thelen <phillip@habitica.com>
Date:   Mon Jul 1 18:48:17 2024 +0200

    fix hatching dialog

commit 0e5126df5ec9f3d35a9d49f6b2f3a5f005401c37
Author: Phillip Thelen <phillip@habitica.com>
Date:   Mon Jul 1 18:48:12 2024 +0200

    fix popover alignment

commit 7362af92366ff0460bef89901182060940aca841
Author: Phillip Thelen <phillip@habitica.com>
Date:   Fri Jun 28 17:07:03 2024 +0200

    fix item display

commit cf353efdb76005adeea7df9757ad4a9dc06d71ba
Author: Phillip Thelen <phillip@habitica.com>
Date:   Fri Jun 28 16:59:13 2024 +0200

    fix pet display

commit caf0cba9f226f54bf045a2f0fa5d5275de67b01c
Author: Phillip Thelen <phillip@habitica.com>
Date:   Fri Jun 28 15:24:39 2024 +0200

    fix background icon display

commit 3b06febc01b6619eae4dfc906204283621d77a58
Author: Phillip Thelen <phillip@habitica.com>
Date:   Wed Jun 26 12:30:04 2024 +0200

    fix sprites for notifications

commit 160b2debdc6013a1a74da0b504438728335ba274
Author: Phillip Thelen <phillip@habitica.com>
Date:   Wed Jun 26 10:35:13 2024 +0200

    fix gear display in profile

commit b200a2f17d19c46579685b4ec0492e2e17e7d23d
Author: Phillip Thelen <phillip@habitica.com>
Date:   Wed Jun 26 10:28:11 2024 +0200

    fix sprites for keys to the kennel

commit 3614e7a8fb5c75bf0b76a81f872c0e838699f91f
Author: Phillip Thelen <phillip@habitica.com>
Date:   Wed Jun 26 10:28:00 2024 +0200

    fix sprites on avatar customization

commit 35f993d055ccdb2b16a89e2045e1252b4d68830c
Author: Phillip Thelen <phillip@habitica.com>
Date:   Wed Jun 26 09:18:41 2024 +0200

    fix hover icons

commit 28fc80115edee93e743950a64b9504b7e80a25da
Author: Phillip Thelen <phillip@habitica.com>
Date:   Tue Jun 11 16:50:37 2024 +0200

    remove console

commit b041c676792c67e6913691ccd4874fa898c6ccbc
Author: Phillip Thelen <phillip@habitica.com>
Date:   Tue Jun 11 15:18:44 2024 +0200

    more lint fixes

commit f4261d04402e42f31812ad2a92e5a12ab6f916af
Author: Phillip Thelen <phillip@habitica.com>
Date:   Tue Jun 11 15:18:16 2024 +0200

    fix lint

commit 878ee8f77b3c3be0ad00d4f9dfba3398601f6a8d
Author: Phillip Thelen <phillip@habitica.com>
Date:   Tue Jun 11 13:23:08 2024 +0200

    support gifs

commit aac24715aac79ae8d6acdaeeb1729140332d7b3f
Author: Phillip Thelen <phillip@habitica.com>
Date:   Tue Jun 11 13:15:52 2024 +0200

    move avatar customization to sprites

commit f4d3663130e4aacbdf4fc851c9044d96834ec865
Author: Phillip Thelen <phillip@habitica.com>
Date:   Fri Jun 7 17:25:19 2024 +0200

    Move more sprites out of css

commit 6e6b4c981a405e5e7233cb016f42e3436a14e72b
Author: Phillip Thelen <phillip@habitica.com>
Date:   Fri Jun 7 16:59:30 2024 +0200

    add new sprite to item and shopItem component

commit 8712413f5da25ced5d6a09356034bc7f6806502c
Author: Phillip Thelen <phillip@habitica.com>
Date:   Fri Jun 7 16:37:24 2024 +0200

    use new sprites for pets list

commit 1172893826737bd6b047c2a22e1a625fdc7fb3ac
Author: Phillip Thelen <phillip@habitica.com>
Date:   Wed Jun 5 09:43:51 2024 +0200

    Begin building new system for loading sprites
2024-07-29 14:10:27 -05:00

188 lines
3.7 KiB
Vue

<template>
<div
v-if="items.length > 1"
class="customize-options mb-4"
>
<div
v-for="option in items"
:key="option.key"
:id="option.class"
class="outer-option-background"
:class="{
premium: Boolean(option.gem),
active: option.active || currentValue === option.key,
none: option.none,
hide: option.hide }"
@click="option.click(option)"
>
<b-popover
:target="option.class"
triggers="hover focus"
placement="bottom"
:prevent-overflow="false"
>
<strong> {{ option.text }} </strong>
</b-popover>
<div class="option">
<Sprite
v-if="!option.none"
class="sprite"
:prefix="option.isGear ? 'shop' : 'icon'"
:imageName="option.imageName"
:image-name="option.imageName"
/>
<div
v-else
class="redline-outer"
>
<div class="redline"></div>
</div>
</div>
</div>
</div>
</template>
<script>
import gem from '@/assets/svg/gem.svg';
import gold from '@/assets/svg/gold.svg';
import { avatarEditorUtilities } from '../../mixins/avatarEditUtilities';
import Sprite from '@/components/ui/sprite.vue';
export default {
components: {
Sprite,
},
mixins: [
avatarEditorUtilities,
],
props: ['items', 'currentValue'],
data () {
return {
icons: Object.freeze({
gem,
gold,
}),
};
},
methods: {
unlock () {
this.$emit('unlock');
},
},
};
</script>
<style lang="scss" scoped>
@import '~@/assets/scss/colors.scss';
.customize-options {
width: 100%;
}
.hide {
display: none !important;
}
.outer-option-background {
display: inline-block;
vertical-align: top;
pointer-events: visible;
cursor: pointer;
&.premium {
height: 120px;
width: 96px;
margin-left: 8px;
margin-right: 8px;
margin-bottom: 8px;
.option {
margin: 12px 16px;
}
}
&.locked {
border-radius: 2px;
border: 1px solid transparent;
box-shadow: 0 2px 2px 0 rgba(26, 24, 29, 0.16), 0 1px 4px 0 rgba(26, 24, 29, 0.12);
background-color: $white;
.option {
border: none;
border-radius: 2px;
}
&:hover {
box-shadow: 0 4px 4px 0 rgba($black, 0.16), 0 1px 8px 0 rgba($black, 0.12);
border: 1px solid $purple-500;
}
}
&:not(.locked):not(.active) {
.option:hover {
background-color: rgba($purple-300, .25);
}
}
&.premium:not(.locked):not(.active) {
border-radius: 2px;
background-color: rgba(59, 202, 215, 0.1);
}
&.none .option {
.sprite {
opacity: 0.24;
}
.redline-outer {
height: 68px;
width: 68px;
position: absolute;
bottom: 0;
margin: 0 auto 0 0;
.redline {
width: 68px;
height: 4px;
display: block;
background: red;
transform: rotate(-45deg);
position: absolute;
top: 0;
margin-top: 30px;
margin-bottom: 20px;
}
}
}
&.active .option {
background: white;
border: solid 4px $purple-300;
}
&.premium:not(.active) .option {
border-radius: 8px;
}
}
.option {
vertical-align: bottom;
height: 76px;
width: 76px;
border: 4px solid transparent;
border-radius: 10px;
position: relative;
&:hover {
cursor: pointer;
}
}
.outer-option-background:not(.none) {
.sprite.customize-option {
margin-top: 0;
margin-left: 0;
}
}
</style>