Merge pull request #2230 from nextcloud/enh/scroll-stacks

This commit is contained in:
Julius Härtl
2020-11-06 11:57:31 +01:00
committed by GitHub
3 changed files with 59 additions and 42 deletions

View File

@@ -194,6 +194,8 @@ export default {
.smooth-dnd-container.horizontal { .smooth-dnd-container.horizontal {
display: flex; display: flex;
align-items: stretch; align-items: stretch;
height: 100%;
.smooth-dnd-draggable-wrapper::v-deep { .smooth-dnd-draggable-wrapper::v-deep {
display: flex; display: flex;
height: auto; height: auto;
@@ -201,21 +203,17 @@ export default {
.stack { .stack {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
position: relative;
.smooth-dnd-container.vertical { .smooth-dnd-container.vertical {
flex-grow: 1; flex-grow: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding: 0; padding: $stack-spacing;
/** overflow-x: hidden;
* Use this to scroll each stack individually overflow-y: auto;
* This currenly has the issue that the popover menu will be cut off padding-top: 15px;
*/ margin-top: -10px;
/*
overflow-x: scroll;
height: calc(100vh - 50px - 44px * 2 - 30px);
max-height: calc(100vh - 50px - 44px * 2 - 30px);
*/
} }
.smooth-dnd-container.vertical > .smooth-dnd-draggable-wrapper { .smooth-dnd-container.vertical > .smooth-dnd-draggable-wrapper {

View File

@@ -23,14 +23,14 @@
<template> <template>
<div class="stack"> <div class="stack">
<div v-click-outside="stopCardCreation" class="stack--header"> <div v-click-outside="stopCardCreation" class="stack__header" :class="{'stack__header--add': showAddCard }">
<transition name="fade" mode="out-in"> <transition name="fade" mode="out-in">
<h3 v-if="!canManage || isArchived"> <h3 v-if="!canManage || isArchived">
{{ stack.title }} {{ stack.title }}
</h3> </h3>
<h3 v-else-if="!editing" <h3 v-else-if="!editing"
v-tooltip="stack.title" v-tooltip="stack.title"
class="stack--title" class="stack__title"
@click="startEditing(stack)"> @click="startEditing(stack)">
{{ stack.title }} {{ stack.title }}
</h3> </h3>
@@ -71,7 +71,7 @@
</Modal> </Modal>
<transition name="slide-top" appear> <transition name="slide-top" appear>
<div v-if="showAddCard" class="stack--card-add"> <div v-if="showAddCard" class="stack__card-add">
<form :class="{ 'icon-loading-small': stateCardCreating }" <form :class="{ 'icon-loading-small': stateCardCreating }"
@submit.prevent.stop="clickAddCard()"> @submit.prevent.stop="clickAddCard()">
<label for="new-stack-input-main" class="hidden-visually">{{ t('deck', 'Add a new card') }}</label> <label for="new-stack-input-main" class="hidden-visually">{{ t('deck', 'Add a new card') }}</label>
@@ -267,24 +267,43 @@ export default {
@import './../../css/variables'; @import './../../css/variables';
.stack { .stack {
width: $stack-width; width: $stack-width + $stack-spacing*3;
margin-left: $stack-spacing; margin-left: $stack-spacing/2;
margin-right: $stack-spacing; margin-right: $stack-spacing/2;
} }
.stack--header { .stack__header {
display: flex; display: flex;
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 100; z-index: 100;
padding: 3px; padding-left: $card-spacing;
margin: 3px -3px;
margin-right: -10px;
margin-top: 0;
margin-bottom: 3px;
background-color: var(--color-main-background-translucent);
cursor: grab; cursor: grab;
// Smooth fade out of the cards at the top
&:before {
content: ' ';
display: block;
position: absolute;
background-image: linear-gradient(180deg, var(--color-main-background) 3px, transparent 100%);
width: 100%;
height: 25px;
top: 35px;
right: 6px;
z-index: 99;
transition: top var(--animation-slow);
}
&--add:before {
height: 80px;
background-image: linear-gradient(180deg, var(--color-main-background) 68px, transparent 100%);
}
& > * {
position: relative;
z-index: 100;
}
h3, form { h3, form {
flex-grow: 1; flex-grow: 1;
display: flex; display: flex;
@@ -296,30 +315,28 @@ export default {
} }
} }
.stack--title { .stack__title {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
max-width: calc($stack-width - 60px); max-width: calc($stack-width - 60px);
} }
.stack--card-add { .stack__card-add {
position: sticky;
top: 52px;
height: 52px; height: 52px;
z-index: 100; z-index: 100;
display: flex; display: flex;
margin-left: 12px;
margin-right: 12px;
margin-top: 5px;
margin-bottom: 20px;
background-color: var(--color-main-background); background-color: var(--color-main-background);
margin-left: -10px;
margin-right: -10px;
padding-top: 3px;
form { form {
display: flex; display: flex;
width: 100%; width: 100%;
margin: 10px; margin: 0;
margin-top: 0; margin-right: 6px;
margin-bottom: 10px;
box-shadow: 0 0 3px var(--color-box-shadow); box-shadow: 0 0 3px var(--color-box-shadow);
border-radius: var(--border-radius-large); border-radius: var(--border-radius-large);
overflow: hidden; overflow: hidden;
@@ -339,10 +356,6 @@ export default {
} }
} }
.stack .smooth-dnd-container.vertical {
margin-top: 3px;
}
/** /**
* Rules to handle scrolling behaviour are inherited from Board.vue * Rules to handle scrolling behaviour are inherited from Board.vue
*/ */

View File

@@ -131,6 +131,13 @@ export default {
return [...this.card.labels].sort((a, b) => (a.title < b.title) ? -1 : 1) return [...this.card.labels].sort((a, b) => (a.title < b.title) ? -1 : 1)
}, },
}, },
watch: {
currentCard(newValue) {
if (newValue) {
this.$nextTick(() => this.$el.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'center' }))
}
},
},
methods: { methods: {
openCard() { openCard() {
const boardId = this.card && this.card.boardId ? this.card.boardId : this.$route.params.id const boardId = this.card && this.card.boardId ? this.card.boardId : this.$route.params.id
@@ -160,10 +167,6 @@ export default {
@import './../../css/animations'; @import './../../css/animations';
@import './../../css/variables'; @import './../../css/variables';
.card:hover {
box-shadow: 0 0 5px 1px var(--color-box-shadow);
}
.card { .card {
transition: box-shadow 0.1s ease-in-out; transition: box-shadow 0.1s ease-in-out;
box-shadow: 0 0 2px 0 var(--color-box-shadow); box-shadow: 0 0 2px 0 var(--color-box-shadow);
@@ -180,9 +183,12 @@ export default {
border: 2px solid var(--color-border); border: 2px solid var(--color-border);
} }
&.current-card { &:hover {
box-shadow: 0 0 5px 0 var(--color-box-shadow); box-shadow: 0 0 5px 0 var(--color-box-shadow);
} }
&.current-card {
box-shadow: 0 0 5px 1px var(--color-box-shadow);
}
.card-upper { .card-upper {
display: flex; display: flex;