Improve hover highlight UI effects for cards in dark mode
In light mode a change in elevation changes the drop shadow, but this is all but invisible in dark mode, so I added a highlight to the cards when hovering to show that the card can be expanded with a click
This commit is contained in:
43
app/imports/ui/components/CardHighlight.vue
Normal file
43
app/imports/ui/components/CardHighlight.vue
Normal file
@@ -0,0 +1,43 @@
|
||||
<template lang="html">
|
||||
<div
|
||||
v-if="dark || theme.isDark"
|
||||
class="overlay"
|
||||
:class="{active, 'extra-bright': dark && !theme.isDark}"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="js">
|
||||
export default {
|
||||
inject: {
|
||||
theme: {
|
||||
default: {
|
||||
isDark: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
props: {
|
||||
active: Boolean,
|
||||
dark: Boolean,
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="css" scoped>
|
||||
.overlay {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
pointer-events: none;
|
||||
background-color: #fff;
|
||||
opacity: 0;
|
||||
transition: opacity 0.1s linear;
|
||||
}
|
||||
.overlay.active {
|
||||
opacity: 0.08;
|
||||
}
|
||||
.overlay.active.extra-bright {
|
||||
opacity: 0.3;
|
||||
}
|
||||
</style>
|
||||
@@ -2,15 +2,17 @@
|
||||
<v-card
|
||||
:hover="hasClickListener"
|
||||
class="toolbar-card"
|
||||
:class="hovering ? 'elevation-8': ''"
|
||||
:class="{'transparent-toolbar': transparentToolbar, hovering}"
|
||||
:elevation="hovering ? 8 : undefined"
|
||||
@click.native="$emit('click')"
|
||||
>
|
||||
<v-toolbar
|
||||
flat
|
||||
:style="`transform: none; ${hasToolbarClickListener ? 'cursor: pointer;' : ''}`"
|
||||
:color="color"
|
||||
:dark="isDark"
|
||||
:light="!isDark"
|
||||
:class="{}"
|
||||
:color="transparentToolbar ? undefined : color"
|
||||
:dark="transparentToolbar ? undefined : isDark"
|
||||
:light="transparentToolbar ? undefined : !isDark"
|
||||
@click="$emit('toolbarclick')"
|
||||
@mouseover="hoverToolbar(true)"
|
||||
@mouseleave="hoverToolbar(false)"
|
||||
@@ -20,14 +22,19 @@
|
||||
<div>
|
||||
<slot />
|
||||
</div>
|
||||
<card-highlight :active="hovering" />
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script lang="js">
|
||||
import isDarkColor from '/imports/ui/utility/isDarkColor.js';
|
||||
import getThemeColor from '/imports/ui/utility/getThemeColor.js';
|
||||
import CardHighlight from '/imports/ui/components/CardHighlight.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
CardHighlight,
|
||||
},
|
||||
props: {
|
||||
color: {
|
||||
type: String,
|
||||
@@ -35,6 +42,7 @@
|
||||
return getThemeColor('secondary');
|
||||
},
|
||||
},
|
||||
transparentToolbar: Boolean,
|
||||
},
|
||||
data(){ return {
|
||||
hovering: false,
|
||||
@@ -62,9 +70,12 @@
|
||||
|
||||
<style lang="css">
|
||||
.toolbar-card .v-toolbar__title {
|
||||
font-size: 14px;
|
||||
font-size: 15px;
|
||||
}
|
||||
.toolbar-card {
|
||||
transition: box-shadow .4s cubic-bezier(0.25, 0.8, 0.25, 1);
|
||||
}
|
||||
.toolbar-card.transparent-toolbar .theme--dark.v-toolbar.v-sheet {
|
||||
background-color: #303030;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
<v-card
|
||||
hover
|
||||
data-id="creature-summary"
|
||||
@mouseover="summaryHover = true"
|
||||
@mouseleave="summaryHover = false"
|
||||
@click="showCharacterForm"
|
||||
>
|
||||
<v-img
|
||||
@@ -18,6 +20,7 @@
|
||||
{{ creature.alignment }}<br>
|
||||
{{ creature.gender }}
|
||||
</v-card-text>
|
||||
<card-highlight :active="summaryHover" />
|
||||
</v-card>
|
||||
</div>
|
||||
<div>
|
||||
@@ -25,9 +28,21 @@
|
||||
data-id="slot-card"
|
||||
@toolbarclick="showSlotDialog"
|
||||
>
|
||||
<v-toolbar-title slot="toolbar">
|
||||
Build
|
||||
</v-toolbar-title>
|
||||
<template slot="toolbar">
|
||||
<v-toolbar-title>
|
||||
Build
|
||||
</v-toolbar-title>
|
||||
<v-spacer />
|
||||
<v-toolbar-title>
|
||||
<v-icon
|
||||
small
|
||||
style="width: 16px;"
|
||||
class="mr-1"
|
||||
>
|
||||
mdi-pencil
|
||||
</v-icon>
|
||||
</v-toolbar-title>
|
||||
</template>
|
||||
<v-card-text style="background-color: inherit;">
|
||||
<slots :creature-id="creatureId" />
|
||||
</v-card-text>
|
||||
@@ -121,6 +136,7 @@ import ColumnLayout from '/imports/ui/components/ColumnLayout.vue';
|
||||
import NoteCard from '/imports/ui/properties/components/persona/NoteCard.vue';
|
||||
import Slots from '/imports/ui/creature/slots/Slots.vue';
|
||||
import ToolbarCard from '/imports/ui/components/ToolbarCard.vue';
|
||||
import CardHighlight from '/imports/ui/components/CardHighlight.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -128,6 +144,7 @@ export default {
|
||||
NoteCard,
|
||||
Slots,
|
||||
ToolbarCard,
|
||||
CardHighlight,
|
||||
},
|
||||
props: {
|
||||
creatureId: {
|
||||
@@ -135,6 +152,9 @@ export default {
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data(){return {
|
||||
summaryHover: false,
|
||||
}},
|
||||
computed: {
|
||||
highestClassLevels(){
|
||||
let highestLevels = {};
|
||||
|
||||
@@ -55,9 +55,7 @@
|
||||
</v-card>
|
||||
</div>
|
||||
<div>
|
||||
<toolbar-card
|
||||
:color="creature.color"
|
||||
>
|
||||
<toolbar-card transparent-toolbar>
|
||||
<v-toolbar-title slot="toolbar">
|
||||
Equipped
|
||||
</v-toolbar-title>
|
||||
@@ -71,9 +69,7 @@
|
||||
</toolbar-card>
|
||||
</div>
|
||||
<div>
|
||||
<toolbar-card
|
||||
:color="creature.color"
|
||||
>
|
||||
<toolbar-card transparent-toolbar>
|
||||
<v-toolbar-title slot="toolbar">
|
||||
Carried
|
||||
</v-toolbar-title>
|
||||
|
||||
@@ -242,7 +242,7 @@
|
||||
<div
|
||||
v-for="action in actions"
|
||||
:key="action._id"
|
||||
class="actions"
|
||||
class="action"
|
||||
>
|
||||
<action-card
|
||||
:model="action"
|
||||
@@ -253,7 +253,7 @@
|
||||
<div
|
||||
v-for="attack in attacks"
|
||||
:key="attack._id"
|
||||
class="attacks"
|
||||
class="attack"
|
||||
>
|
||||
<action-card
|
||||
attack
|
||||
|
||||
@@ -94,6 +94,7 @@
|
||||
/>
|
||||
</template>
|
||||
</div>
|
||||
<card-highlight :active="hovering" />
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
@@ -107,6 +108,7 @@ import PropertyIcon from '/imports/ui/properties/shared/PropertyIcon.vue';
|
||||
import RollPopup from '/imports/ui/components/RollPopup.vue';
|
||||
import MarkdownText from '/imports/ui/components/MarkdownText.vue';
|
||||
import {snackbar} from '/imports/ui/components/snackbars/SnackbarQueue.js';
|
||||
import CardHighlight from '/imports/ui/components/CardHighlight.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -115,6 +117,7 @@ export default {
|
||||
MarkdownText,
|
||||
PropertyIcon,
|
||||
RollPopup,
|
||||
CardHighlight
|
||||
},
|
||||
inject: {
|
||||
context: {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
<v-card
|
||||
:hover="hasClickListener"
|
||||
@click="click"
|
||||
@mouseover="hasClickListener ? hovering = true : undefined"
|
||||
@mouseleave="hasClickListener ? hovering = false : undefined"
|
||||
>
|
||||
<div class="layout align-center">
|
||||
<roll-popup
|
||||
@@ -31,6 +33,7 @@
|
||||
{{ model.name }}
|
||||
</v-card-title>
|
||||
</div>
|
||||
<card-highlight :active="hasClickListener && hovering" />
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
@@ -39,10 +42,12 @@
|
||||
import RollPopup from '/imports/ui/components/RollPopup.vue';
|
||||
import doCheck from '/imports/api/engine/actions/doCheck.js';
|
||||
import {snackbar} from '/imports/ui/components/snackbars/SnackbarQueue.js';
|
||||
import CardHighlight from '/imports/ui/components/CardHighlight.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
RollPopup,
|
||||
CardHighlight,
|
||||
},
|
||||
inject: {
|
||||
context: {
|
||||
@@ -57,6 +62,7 @@
|
||||
},
|
||||
data(){return {
|
||||
checkLoading: false,
|
||||
hovering: false,
|
||||
}},
|
||||
computed: {
|
||||
hasClickListener(){
|
||||
|
||||
@@ -43,11 +43,17 @@
|
||||
</div>
|
||||
</div>
|
||||
</v-layout>
|
||||
<card-highlight :active="hover" />
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script lang="js">
|
||||
import CardHighlight from '/imports/ui/components/CardHighlight.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
CardHighlight,
|
||||
},
|
||||
inject: {
|
||||
context: { default: {} }
|
||||
},
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
:dark="model.color && isDark"
|
||||
:light="model.color && !isDark"
|
||||
@click="clickProperty(model._id)"
|
||||
@mouseover="hover = true"
|
||||
@mouseleave="hover = false"
|
||||
>
|
||||
<v-card-title class="text-h6">
|
||||
{{ model.name }}
|
||||
@@ -16,23 +18,39 @@
|
||||
:model="model.summary"
|
||||
/>
|
||||
</v-card-text>
|
||||
<card-highlight
|
||||
:active="hover"
|
||||
:dark="theme.isDark"
|
||||
/>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script lang="js">
|
||||
import PropertyDescription from '/imports/ui/properties/viewers/shared/PropertyDescription.vue';
|
||||
import isDarkColor from '/imports/ui/utility/isDarkColor.js';
|
||||
import CardHighlight from '/imports/ui/components/CardHighlight.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
PropertyDescription,
|
||||
CardHighlight,
|
||||
},
|
||||
inject: {
|
||||
theme: {
|
||||
default: {
|
||||
isDark: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
props: {
|
||||
model: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data(){ return{
|
||||
hover: false,
|
||||
}},
|
||||
computed: {
|
||||
isDark(){
|
||||
return isDarkColor(this.model.color);
|
||||
|
||||
Reference in New Issue
Block a user