Skip to content
Snippets Groups Projects
Commit 16da9981 authored by Petar Hristov's avatar Petar Hristov :speech_balloon:
Browse files

Fix: CoscineCard

parent 424989b4
No related branches found
No related tags found
No related merge requests found
Pipeline #890703 passed
...@@ -2,35 +2,39 @@ ...@@ -2,35 +2,39 @@
<b-card <b-card
no-body no-body
class="coscine_card m-2 text-center" class="coscine_card m-2 text-center"
:class="isLoading ? 'bg-light' : ''" :class="isLoading || disabled ? 'bg-light' : ''"
@click.prevent="openCard()" @click.prevent="openCard()"
> >
<!-- Stretched Link (Card) --> <!-- Stretched Link (Card) -->
<a <a
v-if="!isLoading && !isDisabled" v-if="!isLoading && !disabled"
:href="hrefFromRouter(to)" :href="hrefFromRouter(to)"
class="stretched-link" class="stretched-link"
/> />
<!-- Badge --> <!-- Badge -->
<template #header> <template #header>
<b-badge v-if="badgeVisibility" pill :variant="badgeType"> <b-badge
v-if="badgeVisibility"
pill
:variant="disabled ? 'secondary' : badgeType"
>
{{ badgeText }} {{ badgeText }}
</b-badge> </b-badge>
</template> </template>
<!-- Settings Button --> <!-- Settings Button -->
<b-button <b-button
v-if="toSettings" v-if="!disabled && toSettings"
size="sm" size="sm"
variant="outline-primary" variant="outline-primary"
class="settings_button" class="settings_button"
@click.stop.prevent="settingsCard" @click.stop.prevent="openSettings"
> >
<b-icon icon="pencil-fill" /> <b-icon icon="pencil-fill" />
<!-- Stretched Link (Settings) --> <!-- Stretched Link (Settings) -->
<a <a
v-if="!isLoading && !isDisabled" v-if="!isLoading && !disabled"
:href="hrefFromRouter(toSettings)" :href="hrefFromRouter(toSettings)"
class="stretched-link" class="stretched-link"
/> />
...@@ -41,7 +45,12 @@ ...@@ -41,7 +45,12 @@
<!-- Loading Spinner --> <!-- Loading Spinner -->
<b-spinner v-if="isLoading" variant="primary" class="card_icon" /> <b-spinner v-if="isLoading" variant="primary" class="card_icon" />
<!-- Icon --> <!-- Icon -->
<b-icon v-else :icon="cardIcon" variant="primary" class="card_icon" /> <b-icon
v-else
:icon="cardIcon"
:variant="disabled ? 'secondary' : 'primary'"
class="card_icon"
/>
</div> </div>
<!-- Title --> <!-- Title -->
<b-card-text> <b-card-text>
...@@ -93,7 +102,7 @@ export default defineComponent({ ...@@ -93,7 +102,7 @@ export default defineComponent({
default: false, default: false,
type: Boolean, type: Boolean,
}, },
isDisabled: { disabled: {
default: false, default: false,
type: Boolean, type: Boolean,
}, },
...@@ -128,10 +137,14 @@ export default defineComponent({ ...@@ -128,10 +137,14 @@ export default defineComponent({
return routeData.href; return routeData.href;
}, },
openCard() { openCard() {
if (!this.disabled) {
this.$emit("open-card", this.to); this.$emit("open-card", this.to);
}
}, },
settingsCard() { openSettings() {
if (!this.disabled) {
this.$emit("open-card-settings", this.toSettings); this.$emit("open-card-settings", this.toSettings);
}
}, },
}, },
}); });
...@@ -145,7 +158,12 @@ export default defineComponent({ ...@@ -145,7 +158,12 @@ export default defineComponent({
max-width: 9rem; max-width: 9rem;
max-height: 9rem; max-height: 9rem;
} }
.coscine_card:hover {
background-color: #cccccc !important;
}
.coscine_card:hover .settings_button {
visibility: visible;
}
.card-header { .card-header {
/* Header + (Icon) + Text = Card */ /* Header + (Icon) + Text = Card */
/* (Padding) + Settings Icon = Header */ /* (Padding) + Settings Icon = Header */
...@@ -155,15 +173,6 @@ export default defineComponent({ ...@@ -155,15 +173,6 @@ export default defineComponent({
border: 0; border: 0;
text-align: center; text-align: center;
} }
.coscine_card:hover {
background-color: #cccccc;
}
.card.coscine_card:hover .settings_button {
visibility: visible;
}
.settings_button { .settings_button {
/* Pin button in the top-right corner */ /* Pin button in the top-right corner */
position: absolute; position: absolute;
...@@ -176,7 +185,6 @@ export default defineComponent({ ...@@ -176,7 +185,6 @@ export default defineComponent({
height: 1.7rem; height: 1.7rem;
padding: 0; padding: 0;
} }
.card_icon { .card_icon {
/* Header + (Icon) + Text = Card */ /* Header + (Icon) + Text = Card */
width: 2.9rem; width: 2.9rem;
......
...@@ -11,11 +11,10 @@ ...@@ -11,11 +11,10 @@
<b-card-group id="card-deck" deck> <b-card-group id="card-deck" deck>
<CoscineCard <CoscineCard
id="addResource" id="addResource"
:style="cardStyleAddResource"
:title="$t('page.project.addResource')" :title="$t('page.project.addResource')"
type="create" type="create"
:to="toCreateResource()" :to="toCreateResource()"
:is-disabled="!isEmailValid" :disabled="!isEmailValid"
@open-card="openCreateResource($event)" @open-card="openCreateResource($event)"
/> />
<b-tooltip target="addResource"> <b-tooltip target="addResource">
...@@ -40,7 +39,6 @@ ...@@ -40,7 +39,6 @@
:key="index" :key="index"
:title="resource.displayName" :title="resource.displayName"
type="resource" type="resource"
:style="cardStyle"
:badge-visibility="resource.archived" :badge-visibility="resource.archived"
:badge-text="$t('default.archived')" :badge-text="$t('default.archived')"
:to="toResource(resource)" :to="toResource(resource)"
...@@ -54,6 +52,7 @@ ...@@ -54,6 +52,7 @@
:to="{}" :to="{}"
:title="$t('default.loading')" :title="$t('default.loading')"
:is-loading="!resources" :is-loading="!resources"
:disabled="true"
/> />
</b-card-group> </b-card-group>
</div> </div>
...@@ -69,7 +68,6 @@ ...@@ -69,7 +68,6 @@
<CoscineCard <CoscineCard
:title="$t('page.listProjects.addProject')" :title="$t('page.listProjects.addProject')"
type="create" type="create"
:style="cardStyle"
:to="toCreateSubProject()" :to="toCreateSubProject()"
@open-card="openCreateProject($event)" @open-card="openCreateProject($event)"
/> />
...@@ -86,7 +84,6 @@ ...@@ -86,7 +84,6 @@
:key="index" :key="index"
:title="subProject.displayName" :title="subProject.displayName"
type="project" type="project"
:style="cardStyle"
:to="toSubProject(subProject)" :to="toSubProject(subProject)"
@open-card="openProject($event, subProject)" @open-card="openProject($event, subProject)"
/> />
...@@ -130,14 +127,6 @@ export default defineComponent({ ...@@ -130,14 +127,6 @@ export default defineComponent({
return { projectStore, resourceStore, userStore }; return { projectStore, resourceStore, userStore };
}, },
data() {
return {
card: {
backgroundHoverActive: "#cccccc",
backgroundHoverInactive: "transparent",
},
};
},
computed: { computed: {
project(): ProjectObject | null { project(): ProjectObject | null {
...@@ -170,25 +159,6 @@ export default defineComponent({ ...@@ -170,25 +159,6 @@ export default defineComponent({
user(): UserObject | null { user(): UserObject | null {
return this.userStore.user; return this.userStore.user;
}, },
cardStyle() {
return {
"--coscine_card-background-color--hover":
this.card.backgroundHoverActive,
};
},
cardStyleAddResource() {
if (this.isEmailValid) {
return {
"--coscine_card-background-color--hover":
this.card.backgroundHoverActive,
};
} else {
return {
"--coscine_card-background-color--hover":
this.card.backgroundHoverInactive,
};
}
},
}, },
methods: { methods: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment