feat(lite/component): Change style of active items in tree view (#6397)

This commit is contained in:
Thierry Goettelmann 2022-09-06 10:04:22 +02:00 committed by Julien Fontanet
parent 971cdaa44f
commit ba2679d3d7
3 changed files with 10 additions and 7 deletions

View File

@ -1,7 +1,7 @@
<template>
<li v-if="host" class="infra-host-item">
<InfraItemLabel
:current="isCurrentHost"
:active="isCurrentHost"
:icon="faServer"
:route="{ name: 'host.dashboard', params: { uuid: host.uuid } }"
>

View File

@ -1,7 +1,9 @@
<template>
<RouterLink v-slot="{ isActive, href, navigate }" :to="route" custom>
<RouterLink v-slot="{ isExactActive, href, navigate }" :to="route" custom>
<div
:class="{ current: isActive || $props.current }"
:class="
isExactActive ? 'exact-active' : $props.active ? 'active' : undefined
"
class="infra-item-label"
v-bind="$attrs"
>
@ -25,7 +27,7 @@ import type { IconDefinition } from "@fortawesome/fontawesome-common-types";
defineProps<{
icon: IconDefinition;
route: RouteLocationRaw;
current?: boolean;
active?: boolean;
}>();
</script>
@ -42,12 +44,13 @@ defineProps<{
background-color: var(--background-color-secondary);
}
&:active {
&:active,
&.active {
color: var(--color-extra-blue-base);
background-color: var(--background-color-primary);
}
&.current {
&.exact-active {
color: var(--color-blue-scale-100);
background-color: var(--background-color-extra-blue);

View File

@ -5,7 +5,7 @@
<InfraItemLabel
:icon="faBuildings"
:route="{ name: 'pool.dashboard', params: { uuid: pool.uuid } }"
current
active
>
{{ pool.name_label || '(Pool)' }}
</InfraItemLabel>