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
|
<v-card
|
||||||
:hover="hasClickListener"
|
:hover="hasClickListener"
|
||||||
class="toolbar-card"
|
class="toolbar-card"
|
||||||
:class="hovering ? 'elevation-8': ''"
|
:class="{'transparent-toolbar': transparentToolbar, hovering}"
|
||||||
|
:elevation="hovering ? 8 : undefined"
|
||||||
@click.native="$emit('click')"
|
@click.native="$emit('click')"
|
||||||
>
|
>
|
||||||
<v-toolbar
|
<v-toolbar
|
||||||
flat
|
flat
|
||||||
:style="`transform: none; ${hasToolbarClickListener ? 'cursor: pointer;' : ''}`"
|
:style="`transform: none; ${hasToolbarClickListener ? 'cursor: pointer;' : ''}`"
|
||||||
:color="color"
|
:class="{}"
|
||||||
:dark="isDark"
|
:color="transparentToolbar ? undefined : color"
|
||||||
:light="!isDark"
|
:dark="transparentToolbar ? undefined : isDark"
|
||||||
|
:light="transparentToolbar ? undefined : !isDark"
|
||||||
@click="$emit('toolbarclick')"
|
@click="$emit('toolbarclick')"
|
||||||
@mouseover="hoverToolbar(true)"
|
@mouseover="hoverToolbar(true)"
|
||||||
@mouseleave="hoverToolbar(false)"
|
@mouseleave="hoverToolbar(false)"
|
||||||
@@ -20,14 +22,19 @@
|
|||||||
<div>
|
<div>
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
|
<card-highlight :active="hovering" />
|
||||||
</v-card>
|
</v-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="js">
|
<script lang="js">
|
||||||
import isDarkColor from '/imports/ui/utility/isDarkColor.js';
|
import isDarkColor from '/imports/ui/utility/isDarkColor.js';
|
||||||
import getThemeColor from '/imports/ui/utility/getThemeColor.js';
|
import getThemeColor from '/imports/ui/utility/getThemeColor.js';
|
||||||
|
import CardHighlight from '/imports/ui/components/CardHighlight.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
CardHighlight,
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
color: {
|
color: {
|
||||||
type: String,
|
type: String,
|
||||||
@@ -35,6 +42,7 @@
|
|||||||
return getThemeColor('secondary');
|
return getThemeColor('secondary');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
transparentToolbar: Boolean,
|
||||||
},
|
},
|
||||||
data(){ return {
|
data(){ return {
|
||||||
hovering: false,
|
hovering: false,
|
||||||
@@ -62,9 +70,12 @@
|
|||||||
|
|
||||||
<style lang="css">
|
<style lang="css">
|
||||||
.toolbar-card .v-toolbar__title {
|
.toolbar-card .v-toolbar__title {
|
||||||
font-size: 14px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
.toolbar-card {
|
.toolbar-card {
|
||||||
transition: box-shadow .4s cubic-bezier(0.25, 0.8, 0.25, 1);
|
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>
|
</style>
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
<v-card
|
<v-card
|
||||||
hover
|
hover
|
||||||
data-id="creature-summary"
|
data-id="creature-summary"
|
||||||
|
@mouseover="summaryHover = true"
|
||||||
|
@mouseleave="summaryHover = false"
|
||||||
@click="showCharacterForm"
|
@click="showCharacterForm"
|
||||||
>
|
>
|
||||||
<v-img
|
<v-img
|
||||||
@@ -18,6 +20,7 @@
|
|||||||
{{ creature.alignment }}<br>
|
{{ creature.alignment }}<br>
|
||||||
{{ creature.gender }}
|
{{ creature.gender }}
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
|
<card-highlight :active="summaryHover" />
|
||||||
</v-card>
|
</v-card>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -25,9 +28,21 @@
|
|||||||
data-id="slot-card"
|
data-id="slot-card"
|
||||||
@toolbarclick="showSlotDialog"
|
@toolbarclick="showSlotDialog"
|
||||||
>
|
>
|
||||||
<v-toolbar-title slot="toolbar">
|
<template slot="toolbar">
|
||||||
Build
|
<v-toolbar-title>
|
||||||
</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;">
|
<v-card-text style="background-color: inherit;">
|
||||||
<slots :creature-id="creatureId" />
|
<slots :creature-id="creatureId" />
|
||||||
</v-card-text>
|
</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 NoteCard from '/imports/ui/properties/components/persona/NoteCard.vue';
|
||||||
import Slots from '/imports/ui/creature/slots/Slots.vue';
|
import Slots from '/imports/ui/creature/slots/Slots.vue';
|
||||||
import ToolbarCard from '/imports/ui/components/ToolbarCard.vue';
|
import ToolbarCard from '/imports/ui/components/ToolbarCard.vue';
|
||||||
|
import CardHighlight from '/imports/ui/components/CardHighlight.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -128,6 +144,7 @@ export default {
|
|||||||
NoteCard,
|
NoteCard,
|
||||||
Slots,
|
Slots,
|
||||||
ToolbarCard,
|
ToolbarCard,
|
||||||
|
CardHighlight,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
creatureId: {
|
creatureId: {
|
||||||
@@ -135,6 +152,9 @@ export default {
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
data(){return {
|
||||||
|
summaryHover: false,
|
||||||
|
}},
|
||||||
computed: {
|
computed: {
|
||||||
highestClassLevels(){
|
highestClassLevels(){
|
||||||
let highestLevels = {};
|
let highestLevels = {};
|
||||||
|
|||||||
@@ -55,9 +55,7 @@
|
|||||||
</v-card>
|
</v-card>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<toolbar-card
|
<toolbar-card transparent-toolbar>
|
||||||
:color="creature.color"
|
|
||||||
>
|
|
||||||
<v-toolbar-title slot="toolbar">
|
<v-toolbar-title slot="toolbar">
|
||||||
Equipped
|
Equipped
|
||||||
</v-toolbar-title>
|
</v-toolbar-title>
|
||||||
@@ -71,9 +69,7 @@
|
|||||||
</toolbar-card>
|
</toolbar-card>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<toolbar-card
|
<toolbar-card transparent-toolbar>
|
||||||
:color="creature.color"
|
|
||||||
>
|
|
||||||
<v-toolbar-title slot="toolbar">
|
<v-toolbar-title slot="toolbar">
|
||||||
Carried
|
Carried
|
||||||
</v-toolbar-title>
|
</v-toolbar-title>
|
||||||
|
|||||||
@@ -242,7 +242,7 @@
|
|||||||
<div
|
<div
|
||||||
v-for="action in actions"
|
v-for="action in actions"
|
||||||
:key="action._id"
|
:key="action._id"
|
||||||
class="actions"
|
class="action"
|
||||||
>
|
>
|
||||||
<action-card
|
<action-card
|
||||||
:model="action"
|
:model="action"
|
||||||
@@ -253,7 +253,7 @@
|
|||||||
<div
|
<div
|
||||||
v-for="attack in attacks"
|
v-for="attack in attacks"
|
||||||
:key="attack._id"
|
:key="attack._id"
|
||||||
class="attacks"
|
class="attack"
|
||||||
>
|
>
|
||||||
<action-card
|
<action-card
|
||||||
attack
|
attack
|
||||||
|
|||||||
@@ -94,6 +94,7 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
<card-highlight :active="hovering" />
|
||||||
</v-card>
|
</v-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -107,6 +108,7 @@ import PropertyIcon from '/imports/ui/properties/shared/PropertyIcon.vue';
|
|||||||
import RollPopup from '/imports/ui/components/RollPopup.vue';
|
import RollPopup from '/imports/ui/components/RollPopup.vue';
|
||||||
import MarkdownText from '/imports/ui/components/MarkdownText.vue';
|
import MarkdownText from '/imports/ui/components/MarkdownText.vue';
|
||||||
import {snackbar} from '/imports/ui/components/snackbars/SnackbarQueue.js';
|
import {snackbar} from '/imports/ui/components/snackbars/SnackbarQueue.js';
|
||||||
|
import CardHighlight from '/imports/ui/components/CardHighlight.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -115,6 +117,7 @@ export default {
|
|||||||
MarkdownText,
|
MarkdownText,
|
||||||
PropertyIcon,
|
PropertyIcon,
|
||||||
RollPopup,
|
RollPopup,
|
||||||
|
CardHighlight
|
||||||
},
|
},
|
||||||
inject: {
|
inject: {
|
||||||
context: {
|
context: {
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
<v-card
|
<v-card
|
||||||
:hover="hasClickListener"
|
:hover="hasClickListener"
|
||||||
@click="click"
|
@click="click"
|
||||||
|
@mouseover="hasClickListener ? hovering = true : undefined"
|
||||||
|
@mouseleave="hasClickListener ? hovering = false : undefined"
|
||||||
>
|
>
|
||||||
<div class="layout align-center">
|
<div class="layout align-center">
|
||||||
<roll-popup
|
<roll-popup
|
||||||
@@ -31,6 +33,7 @@
|
|||||||
{{ model.name }}
|
{{ model.name }}
|
||||||
</v-card-title>
|
</v-card-title>
|
||||||
</div>
|
</div>
|
||||||
|
<card-highlight :active="hasClickListener && hovering" />
|
||||||
</v-card>
|
</v-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -39,10 +42,12 @@
|
|||||||
import RollPopup from '/imports/ui/components/RollPopup.vue';
|
import RollPopup from '/imports/ui/components/RollPopup.vue';
|
||||||
import doCheck from '/imports/api/engine/actions/doCheck.js';
|
import doCheck from '/imports/api/engine/actions/doCheck.js';
|
||||||
import {snackbar} from '/imports/ui/components/snackbars/SnackbarQueue.js';
|
import {snackbar} from '/imports/ui/components/snackbars/SnackbarQueue.js';
|
||||||
|
import CardHighlight from '/imports/ui/components/CardHighlight.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
RollPopup,
|
RollPopup,
|
||||||
|
CardHighlight,
|
||||||
},
|
},
|
||||||
inject: {
|
inject: {
|
||||||
context: {
|
context: {
|
||||||
@@ -57,6 +62,7 @@
|
|||||||
},
|
},
|
||||||
data(){return {
|
data(){return {
|
||||||
checkLoading: false,
|
checkLoading: false,
|
||||||
|
hovering: false,
|
||||||
}},
|
}},
|
||||||
computed: {
|
computed: {
|
||||||
hasClickListener(){
|
hasClickListener(){
|
||||||
|
|||||||
@@ -43,11 +43,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</v-layout>
|
</v-layout>
|
||||||
|
<card-highlight :active="hover" />
|
||||||
</v-card>
|
</v-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="js">
|
<script lang="js">
|
||||||
|
import CardHighlight from '/imports/ui/components/CardHighlight.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
CardHighlight,
|
||||||
|
},
|
||||||
inject: {
|
inject: {
|
||||||
context: { default: {} }
|
context: { default: {} }
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
:dark="model.color && isDark"
|
:dark="model.color && isDark"
|
||||||
:light="model.color && !isDark"
|
:light="model.color && !isDark"
|
||||||
@click="clickProperty(model._id)"
|
@click="clickProperty(model._id)"
|
||||||
|
@mouseover="hover = true"
|
||||||
|
@mouseleave="hover = false"
|
||||||
>
|
>
|
||||||
<v-card-title class="text-h6">
|
<v-card-title class="text-h6">
|
||||||
{{ model.name }}
|
{{ model.name }}
|
||||||
@@ -16,23 +18,39 @@
|
|||||||
:model="model.summary"
|
:model="model.summary"
|
||||||
/>
|
/>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
|
<card-highlight
|
||||||
|
:active="hover"
|
||||||
|
:dark="theme.isDark"
|
||||||
|
/>
|
||||||
</v-card>
|
</v-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="js">
|
<script lang="js">
|
||||||
import PropertyDescription from '/imports/ui/properties/viewers/shared/PropertyDescription.vue';
|
import PropertyDescription from '/imports/ui/properties/viewers/shared/PropertyDescription.vue';
|
||||||
import isDarkColor from '/imports/ui/utility/isDarkColor.js';
|
import isDarkColor from '/imports/ui/utility/isDarkColor.js';
|
||||||
|
import CardHighlight from '/imports/ui/components/CardHighlight.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
PropertyDescription,
|
PropertyDescription,
|
||||||
|
CardHighlight,
|
||||||
},
|
},
|
||||||
|
inject: {
|
||||||
|
theme: {
|
||||||
|
default: {
|
||||||
|
isDark: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
model: {
|
model: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
data(){ return{
|
||||||
|
hover: false,
|
||||||
|
}},
|
||||||
computed: {
|
computed: {
|
||||||
isDark(){
|
isDark(){
|
||||||
return isDarkColor(this.model.color);
|
return isDarkColor(this.model.color);
|
||||||
|
|||||||
Reference in New Issue
Block a user