Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix styling issues with the related-values display #21854

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
5 changes: 5 additions & 0 deletions .changeset/hip-jeans-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---

Check warning on line 1 in .changeset/hip-jeans-fix.md

View workflow job for this annotation

GitHub Actions / Lint

File ignored by default.
'@directus/app': patch
---

Fixed styling issues with the related-values display
9 changes: 6 additions & 3 deletions app/src/components/v-list-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,10 @@ function onClick(event: PointerEvent) {
&.block {
--v-icon-color: var(--v-icon-color, var(--theme--foreground-subdued));

padding: var(--v-list-item-padding, var(--theme--form--field--input--padding));
padding: var(
--v-list-item-padding,
calc(var(--theme--form--field--input--height) * 0.13333) var(--theme--form--field--input--padding)
formfcw marked this conversation as resolved.
Show resolved Hide resolved
);
position: relative;
display: flex;
height: var(--theme--form--field--input--height);
Expand Down Expand Up @@ -316,8 +319,8 @@ function onClick(event: PointerEvent) {
}

&.dense {
height: 44px;
padding: 4px 8px;
--theme--form--field--input--height: 44px;
padding-inline: calc(var(--theme--form--field--input--padding) / 2);

& + & {
margin-top: var(--v-list-item-margin, 4px);
Expand Down
30 changes: 22 additions & 8 deletions app/src/displays/related-values/related-values.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function getLinkForItem(item: any) {
:disabled="value?.length === 0"
>
<template #activator="{ toggle }">
<span class="toggle" :class="{ subdued: value?.length === 0 }" @click.stop="toggle">
<span class="toggle" :class="{ disabled: value?.length === 0 }" @click.stop="toggle">
<span class="label">
{{ value?.length }}
<template v-if="value?.length >= 100">+</template>
Expand Down Expand Up @@ -108,16 +108,19 @@ function getLinkForItem(item: any) {
</template>

<style lang="scss" scoped>
$toggle-px: 6px;
$toggle-py: 4px;
formfcw marked this conversation as resolved.
Show resolved Hide resolved

.toggle {
position: relative;

&::before {
position: absolute;
top: -6px;
left: -6px;
top: #{$toggle-py * -1};
left: #{$toggle-px * -1};
z-index: 1;
width: calc(100% + 12px);
height: calc(100% + 12px);
width: calc(100% + #{$toggle-px * 2});
height: calc(100% + #{$toggle-py * 2});
background-color: var(--theme--background-normal);
border-radius: var(--theme--border-radius);
opacity: 0;
Expand All @@ -130,17 +133,28 @@ function getLinkForItem(item: any) {
z-index: 2;
}

&:not(.subdued):hover::before {
&:not(.disabled):hover::before {
opacity: 1;
}

&:not(.subdued):active::before {
&:not(.disabled):active::before {
background-color: var(--theme--background-accent);
}
}

.subdued {
.render-template {
> .v-menu {
display: inline;

.toggle {
margin: $toggle-py $toggle-px;
}
}
}
formfcw marked this conversation as resolved.
Show resolved Hide resolved

.disabled {
color: var(--theme--foreground-subdued);
pointer-events: none;
}

.links {
Expand Down