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
@@ -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
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--padding) / 2) var(--theme--form--field--input--padding)
);
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: calc(var(--theme--form--field--input--padding) / 4) calc(var(--theme--form--field--input--padding) / 2);

& + & {
margin-top: var(--v-list-item-margin, 4px);
Expand Down
27 changes: 19 additions & 8 deletions app/src/displays/related-values/related-values.vue
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 @@ -110,14 +110,16 @@ function getLinkForItem(item: any) {
<style lang="scss" scoped>
.toggle {
position: relative;
--toggle-px: 6px;
--toggle-py: 4px;

&::before {
position: absolute;
top: -6px;
left: -6px;
top: calc(-1 * var(--toggle-py));
left: calc(-1 * var(--toggle-px));
z-index: 1;
width: calc(100% + 12px);
height: calc(100% + 12px);
width: calc(100% + var(--toggle-px) * 2);
height: calc(100% + var(--toggle-py) * 2);
background-color: var(--theme--background-normal);
border-radius: var(--theme--border-radius);
opacity: 0;
Expand All @@ -130,17 +132,26 @@ 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);
}

.render-template > .v-menu & {
margin: var(--toggle-py) var(--toggle-px);
}
}

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

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

.links {
Expand Down