Extracted and refactored more common elements of the Entity components.

This commit is contained in:
Fabio Manganiello 2023-04-22 16:31:47 +02:00
parent e213941791
commit f4036be52b
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774
9 changed files with 76 additions and 251 deletions

View file

@ -38,9 +38,5 @@ export default {
font-weight: bold; font-weight: bold;
} }
} }
.icon {
margin-right: 1em;
}
} }
</style> </style>

View file

@ -166,55 +166,4 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
@import "common"; @import "common";
.entity {
.head {
padding: 0.25em;
.icon {
margin-right: 1em;
}
}
}
.collapse-toggler {
display: flex;
align-items: center;
flex: 1;
min-height: 3em;
cursor: pointer;
&:hover {
color: $default-hover-fg;
}
}
.attributes .child {
margin: 0 -0.5em;
padding: 0.5em 1em;
&:not(:last-child) {
border-bottom: 1px solid $border-color-1;
}
&:hover {
cursor: initial;
}
.label {
font-weight: bold;
@include from($tablet) {
@extend .col-m-6;
}
}
.value {
font-size: 0.95em;
text-align: right;
@include from($tablet) {
@extend .col-m-6;
}
}
}
</style> </style>

View file

@ -28,10 +28,4 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
@import "common"; @import "common";
.entity {
.icon {
margin-right: 1em;
}
}
</style> </style>

View file

@ -28,10 +28,4 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
@import "common"; @import "common";
.device-container {
.icon {
margin-right: 1em;
}
}
</style> </style>

View file

@ -1,5 +1,5 @@
<template> <template>
<div class="entity disk-container"> <div class="entity disk-container" :class="{expanded: !isCollapsed}">
<div class="head" @click.stop="isCollapsed = !isCollapsed"> <div class="head" @click.stop="isCollapsed = !isCollapsed">
<div class="col-1 icon"> <div class="col-1 icon">
<EntityIcon <EntityIcon
@ -169,57 +169,6 @@ export default {
text-align: right; text-align: right;
font-weight: bold; font-weight: bold;
} }
.icon {
margin-right: 1em;
}
}
}
.collapse-toggler {
display: flex;
align-items: center;
flex: 1;
min-height: 3em;
cursor: pointer;
@include from($tablet) {
@include until($desktop) {
margin-left: 3.25em;
}
}
&:hover {
color: $default-hover-fg;
}
}
.attributes .child {
margin: 0 -0.5em;
padding: 0.5em 1em;
&:not(:last-child) {
border-bottom: 1px solid $border-color-1;
}
&:hover {
cursor: initial;
}
.label {
font-weight: bold;
@include from($tablet) {
@extend .col-m-6;
}
}
.value {
font-size: 0.95em;
text-align: right;
@include from($tablet) {
@extend .col-m-6;
}
} }
} }
</style> </style>

View file

@ -186,6 +186,12 @@ export default {
} }
} }
@mixin expanded-entity {
background: $selected-bg;
font-weight: bold;
box-shadow: 0 0 3px 2px $default-shadow-color;
}
.entity-container { .entity-container {
width: 100%; width: 100%;
display: flex; display: flex;
@ -195,35 +201,23 @@ export default {
border-bottom: $default-border-3; border-bottom: $default-border-3;
&.with-children:not(.collapsed) { &.with-children:not(.collapsed) {
background: $selected-bg; @include expanded-entity();
font-weight: bold;
box-shadow: 0 0 3px 2px $default-shadow-color;
} }
&:hover { &:hover {
background: $hover-bg; background: $hover-bg;
} }
.collapse-toggler {
display: flex;
justify-content: center;
align-items: center;
flex: 1;
min-height: 3em;
margin-left: 0;
cursor: pointer;
&:hover {
color: $default-hover-fg;
}
}
.adjuster { .adjuster {
cursor: pointer; cursor: pointer;
} }
} }
:deep(.entity-container) { :deep(.entity-container) {
.entity.expanded {
@include expanded-entity();
}
.head { .head {
.name { .name {
display: inline-flex; display: inline-flex;

View file

@ -1,5 +1,5 @@
<template> <template>
<div class="entity memory-stats-container"> <div class="entity memory-stats-container" :class="{expanded: !isCollapsed}">
<div class="head" @click.stop="isCollapsed = !isCollapsed"> <div class="head" @click.stop="isCollapsed = !isCollapsed">
<div class="col-1 icon"> <div class="col-1 icon">
<EntityIcon <EntityIcon
@ -127,63 +127,10 @@ export default {
.entity { .entity {
.head { .head {
padding: 0.25em;
.icon {
margin-right: 1em;
}
.value { .value {
text-align: right; text-align: right;
font-weight: bold; font-weight: bold;
} }
} }
} }
.collapse-toggler {
display: flex;
align-items: center;
flex: 1;
min-height: 3em;
cursor: pointer;
@include from($tablet) {
@include until($desktop) {
margin-left: 3.25em;
}
}
&:hover {
color: $default-hover-fg;
}
}
.attributes .child {
margin: 0 -0.5em;
padding: 0.5em 1em;
&:not(:last-child) {
border-bottom: 1px solid $border-color-1;
}
&:hover {
cursor: initial;
}
.label {
font-weight: bold;
@include from($tablet) {
@extend .col-m-6;
}
}
.value {
font-size: 0.95em;
text-align: right;
@include from($tablet) {
@extend .col-m-6;
}
}
}
</style> </style>

View file

@ -1,5 +1,5 @@
<template> <template>
<div class="entity network-interface-container"> <div class="entity network-interface-container" :class="{expanded: !isCollapsed}">
<div class="head" @click.stop="isCollapsed = !isCollapsed"> <div class="head" @click.stop="isCollapsed = !isCollapsed">
<div class="col-1 icon"> <div class="col-1 icon">
<EntityIcon <EntityIcon
@ -12,7 +12,7 @@
<div class="name" v-text="value.name" /> <div class="name" v-text="value.name" />
</div> </div>
<div class="col-1 collapse-toggler" @click.stop="isCollapsed = !isCollapsed"> <div class="col-1 collapse-toggler">
<i class="fas" <i class="fas"
:class="{'fa-chevron-down': isCollapsed, 'fa-chevron-up': !isCollapsed}" /> :class="{'fa-chevron-down': isCollapsed, 'fa-chevron-up': !isCollapsed}" />
</div> </div>
@ -91,7 +91,8 @@
</div> </div>
</div> </div>
<div class="child head" @click.stop="areAddressesCollapsed = !areAddressesCollapsed"> <div class="child head" :class="{expanded: !areAddressesCollapsed}"
@click.stop="areAddressesCollapsed = !areAddressesCollapsed">
<div class="col-11 label">Addresses</div> <div class="col-11 label">Addresses</div>
<div class="col-1 collapse-toggler pull-right"> <div class="col-1 collapse-toggler pull-right">
<i class="fas" <i class="fas"
@ -105,7 +106,7 @@
v-for="address in (value.addresses || [])" v-for="address in (value.addresses || [])"
:key="address.address" :key="address.address"
> >
<div class="child head" <div class="child head" :class="{expanded: displayedAddresses[address.address]}"
@click.stop="displayedAddresses[address.address] = !displayedAddresses[address.address]" @click.stop="displayedAddresses[address.address] = !displayedAddresses[address.address]"
> >
<div class="col-11 label" v-text="address.address" /> <div class="col-11 label" v-text="address.address" />
@ -160,61 +161,4 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
@import "common"; @import "common";
.entity {
.head {
padding: 0.25em;
.icon {
margin-right: 1em;
}
}
}
.collapse-toggler {
display: flex;
align-items: center;
flex: 1;
min-height: 3em;
cursor: pointer;
@include from($tablet) {
@include until($desktop) {
margin-left: 3.25em;
}
}
&:hover {
color: $default-hover-fg;
}
}
.attributes .child {
margin: 0 -0.5em;
padding: 0.5em 1em;
&:not(:last-child) {
border-bottom: 1px solid $border-color-1;
}
&:hover {
cursor: initial;
}
.label {
font-weight: bold;
@include from($tablet) {
@extend .col-m-6;
}
}
.value {
font-size: 0.95em;
text-align: right;
@include from($tablet) {
@extend .col-m-6;
}
}
}
</style> </style>

View file

@ -10,6 +10,12 @@
display: flex; display: flex;
align-items: center; align-items: center;
padding: 0.75em 0.25em; padding: 0.75em 0.25em;
min-height: 3.5em;
position: relative;
.icon {
margin-right: 1em;
}
.label { .label {
margin-top: 0.25em; margin-top: 0.25em;
@ -38,6 +44,7 @@
background: linear-gradient(0deg, $default-bg-5, $default-bg-2); background: linear-gradient(0deg, $default-bg-5, $default-bg-2);
border-top: 1px solid $border-color-1; border-top: 1px solid $border-color-1;
box-shadow: $border-shadow-bottom; box-shadow: $border-shadow-bottom;
font-weight: normal;
} }
button { button {
@ -51,3 +58,54 @@
} }
} }
} }
.collapse-toggler {
position: absolute;
right: 0;
display: flex;
align-items: center;
justify-content: flex-end;
flex: 1;
min-height: 2em;
margin-right: 1.25em;
cursor: pointer;
&:hover {
color: $default-hover-fg;
}
}
.attributes .child {
padding: 0.5em 1em;
&:not(:last-child) {
border-bottom: 1px solid $border-color-1;
}
&:hover {
cursor: initial;
}
&.head {
cursor: pointer;
&:hover {
background: $hover-bg;
}
}
.label {
font-weight: bold;
@include from($tablet) {
@extend .col-m-6;
}
}
.value {
font-size: 0.95em;
text-align: right;
@include from($tablet) {
@extend .col-m-6;
}
}
}