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

[next] fix(NcListItem): Make paddings smaller again on Nextcloud 30 #5904

Merged
merged 1 commit into from
Aug 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 41 additions & 13 deletions src/components/NcListItem/NcListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@
class="list-item"
:class="{
'list-item--compact': compact,
'list-item--legacy': isLegacy,
'list-item--one-line': oneLine,
}"
@mouseover="handleMouseover"
Expand Down Expand Up @@ -577,6 +578,15 @@ export default {
'update:menuOpen',
],

setup() {
const [major] = window._oc_config?.version.split('.', 2) ?? []
const isLegacy = major && Number.parseInt(major) < 30

return {
isLegacy,
}
},

data() {
return {
hovered: false,
Expand Down Expand Up @@ -773,7 +783,7 @@ export default {

// NcListItem
.list-item {
--list-item-padding: 8px;
--list-item-padding: var(--default-grid-baseline);
// The content are two lines of text and respect the 1.5 line height
--list-item-height: 2lh;
--list-item-border-radius: var(--border-radius-element, 32px);
Expand All @@ -783,9 +793,7 @@ export default {
position: relative;
flex: 0 0 auto;
justify-content: flex-start;
// we need to make sure the elements are not cut off by the border
padding-inline: calc((var(--list-item-height) - var(--list-item-border-radius)) / 2);
padding-block: var(--list-item-padding);
padding: var(--list-item-padding);
width: 100%;
border-radius: var(--border-radius-element, 32px);
cursor: pointer;
Expand All @@ -805,18 +813,29 @@ export default {
}

&--compact {
--list-item-padding: 2px;
--list-item-padding: calc(0.5 * var(--default-grid-baseline)) var(--default-grid-baseline);

&:not(:has(.list-item-content__subname)) {
--list-item-height: var(--default-clickable-area);
}
}
.list-item-content__details {
display: flex;
flex-direction: column;
justify-content: end;
align-items: end;

&--legacy {
--list-item-padding: calc(2 * var(--default-grid-baseline));

&.list-item--compact {
--list-item-padding: var(--default-grid-baseline) calc(2 * var(--default-grid-baseline));
}
}

&--one-line {
--list-item-height: var(--default-clickable-area);
--list-item-border-radius: var(--border-radius-element, calc(var(--default-clickable-area) / 2));
--list-item-padding: 2px;
--list-item-padding: var(--default-grid-baseline);

&#{&}--legacy {
--list-item-padding: 2px calc((var(--list-item-height) - var(--list-item-border-radius)) / 2);
}

.list-item-content__main {
display: flex;
Expand Down Expand Up @@ -851,8 +870,9 @@ export default {
display: flex;
flex: 1 0;
justify-content: space-between;
padding-left: 8px;
padding-left: calc(2 * var(--default-grid-baseline));
min-width: 0;

&__main {
flex: 1 0;
width: 0;
Expand All @@ -863,6 +883,13 @@ export default {
}
}

&__details {
display: flex;
flex-direction: column;
justify-content: end;
align-items: end;
}

&__actions {
flex: 0 0 auto;
align-self: center;
Expand All @@ -886,8 +913,9 @@ export default {
margin: 0 5px;
}
}

&__extra {
margin-top: 4px;
margin-top: var(--default-grid-baseline);
}
}

Expand Down
Loading