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

View File

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

View File

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