Move card styles to component and add compact mode

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2019-04-26 11:43:58 +02:00
parent 93589d3eed
commit ea01804567
6 changed files with 119 additions and 52 deletions

View File

@@ -32,7 +32,7 @@
</div> </div>
</div> </div>
<div v-if="board" class="crumb svg"> <div v-if="board" class="crumb svg">
<div class="board-bullet"></div> <div class="board-bullet" />
<a href="#todo">{{ board.title }}</a> <a href="#todo">{{ board.title }}</a>
<span style="display: inline;" class="icon-shared" /> <span style="display: inline;" class="icon-shared" />
</div> </div>
@@ -42,12 +42,13 @@
<label for="new-stack-input-main" class="hidden-visually">Add a new stack</label> <label for="new-stack-input-main" class="hidden-visually">Add a new stack</label>
<input id="new-stack-input-main" type="text" class="no-close" <input id="new-stack-input-main" type="text" class="no-close"
placeholder="Add a new stack"> placeholder="Add a new stack">
<input class="icon-confirm" type="button" title="Submit" /> <input class="icon-confirm" type="button" title="Submit">
</form> </form>
</div> </div>
<div class="board-action-buttons"> <div class="board-action-buttons">
<button title="Show archived cards" class="icon icon-archive" /> <button title="Show archived cards" class="icon icon-archive" />
<button title="Toggle compact mode" class="icon icon-toggle-compact-expanded" /> <button :class="[(compactMode ? 'icon-toggle-compact-collapsed' : 'icon-toggle-compact-expanded')]" title="Toggle compact mode" class="icon"
@click="toggleCompactMode" />
<router-link v-tooltip="t('deck', 'Board settings')" :to="{name: 'board.details'}" class="icon-settings-dark" <router-link v-tooltip="t('deck', 'Board settings')" :to="{name: 'board.details'}" class="icon-settings-dark"
tag="button" /> tag="button" />
</div> </div>
@@ -57,6 +58,7 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex'
export default { export default {
name: 'Controls', name: 'Controls',
props: { props: {
@@ -66,12 +68,20 @@ export default {
default: null default: null
} }
}, },
computed: {
...mapState({
compactMode: state => state.compactMode
})
},
methods: { methods: {
toggleNav() { toggleNav() {
this.$store.dispatch('toggleNav') this.$store.dispatch('toggleNav')
}, },
toggleSidebar: function() { toggleSidebar: function() {
this.$store.dispatch('toggleSidebar') this.$store.dispatch('toggleSidebar')
},
toggleCompactMode() {
this.$store.dispatch('toggleCompactMode')
} }
} }
} }

View File

@@ -22,13 +22,11 @@
<template> <template>
<app-sidebar <app-sidebar
title="andy-yeo-1387151-unsplash.jpg" :actions="[]"
subtitle="4,3 MB, last edited 19 days ago" title="andy-yeo-1387151-unsplash.jpg"
:actions="[]" subtitle="4,3 MB, last edited 19 days ago"
@close="closeSidebar"> @close="closeSidebar">
<template #action> <template #action />
</template>
<AppSidebarTab name="Description" icon="icon-description"> <AppSidebarTab name="Description" icon="icon-description">
this is the description tab this is the description tab
</AppSidebarTab> </AppSidebarTab>

View File

@@ -22,27 +22,21 @@
<template> <template>
<div class="badges"> <div class="badges">
<i v-if="true" class="icon icon-description" title="" /> <div v-if="true" class="icon icon-description" title="" />
<span v-if="true" class="due"> <div v-if="true" class="due icon icon-calendar-dark">
<i class="icon icon-badge" /> <span>Now</span>
<span data-timestamp="" class="live-relative-timestamp" /> </div>
</span> <div v-if="true" class="card-tasks icon icon-checkmark">
<div v-if="true" class="card-tasks">
<i class="icon icon-checkmark" />
<span>0/0</span> <span>0/0</span>
</div> </div>
<div v-if="true" class="card-files"> <div v-if="true" class="card-files icon icon-files-dark">
<i class="icon icon-files-dark" />
<span>1</span> <span>1</span>
</div> </div>
<div v-if="true" class="card-comments"> <div v-if="true" class="card-comments icon icon-comment">
<i class="icon icon-comment" />
<span>1</span> <span>1</span>
</div> </div>
<div v-if="true" class="card-assigned-users"> <div v-if="true" class="card-assigned-users">
<div class="assigned-user"> <avatar user="admin" />
<avatar user="admin" />
</div>
</div> </div>
</div> </div>
</template> </template>
@@ -70,5 +64,21 @@ export default {
.badges { .badges {
display: flex; display: flex;
flex-grow: 1; flex-grow: 1;
.icon {
opacity: 0.5;
padding: 12px 3px;
background-position: left;
span {
margin-left: 18px;
}
}
.card-assigned-users {
flex-grow: 1;
padding: 6px 0px;
margin-right: -5px;
.avatardiv {
float: right;
}
}
} }
</style> </style>

View File

@@ -21,35 +21,33 @@
--> -->
<template> <template>
<div tag="div" class="card" @click="openCard"> <div :class="{'compact': compactMode}" tag="div" class="card"
@click="openCard">
<div class="card-upper"> <div class="card-upper">
<h3>{{ card.title }}</h3> <h3>{{ card.title }}</h3>
<ul class="labels"> <action :actions="visibilityPopover" />
<li v-for="label in labels" :key="label.id" :style="labelStyle(label)"><span>{{ label.title }}</span></li>
</ul>
</div> </div>
<div class="card-controls compact-item"> <ul class="labels">
<li v-for="label in labels" :key="label.id" :style="labelStyle(label)"><span>{{ label.title }}</span></li>
</ul>
<div v-show="!compactMode" class="card-controls compact-item">
<card-badges /> <card-badges />
<div v-click-outside="hidePopoverMenu">
<a class="icon-more" @click.prevent="togglePopoverMenu" />
<div :class="{open: menuOpened}" class="popovermenu">
<PopoverMenu :menu="visibilityPopover" />
</div>
</div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { PopoverMenu } from 'nextcloud-vue' import { PopoverMenu, Action } from 'nextcloud-vue'
import ClickOutside from 'vue-click-outside' import ClickOutside from 'vue-click-outside'
import { mapState } from 'vuex'
import CardBadges from './CardBadges' import CardBadges from './CardBadges'
import LabelTag from './LabelTag' import LabelTag from './LabelTag'
import Color from '../../mixins/color' import Color from '../../mixins/color'
export default { export default {
name: 'CardItem', name: 'CardItem',
components: { PopoverMenu, CardBadges, LabelTag }, components: { PopoverMenu, CardBadges, LabelTag, Action },
directives: { directives: {
ClickOutside ClickOutside
}, },
@@ -66,9 +64,9 @@ export default {
} }
}, },
computed: { computed: {
compactMode() { ...mapState({
return false compactMode: state => state.compactMode
}, }),
card() { card() {
return this.$store.getters.cardById(this.id) return this.$store.getters.cardById(this.id)
}, },
@@ -91,6 +89,11 @@ export default {
}, },
visibilityPopover() { visibilityPopover() {
return [ return [
{
action: () => {},
icon: 'icon-archive-dark',
text: t('deck', 'Archive card')
},
{ {
action: () => {}, action: () => {},
icon: 'icon-settings-dark', icon: 'icon-settings-dark',
@@ -116,19 +119,58 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.card { .card {
box-shadow: 0 0 5px #aaa; box-shadow: 0 0 5px #aaa;
.icon-more { border-radius: 3px;
width: 44px; margin: 10px;
} width: 260px; // TODO: TMP
.popovermenu { font-size: 100%;
display: none; background-color: var(--color-main-background);
&.open {
display: block; .card-upper {
top: 44px; display: flex;
h3 {
margin: 12px;
flex-grow: 1;
font-size: 100%;
} }
} }
.card-controls > div {
.labels {
display: flex; display: flex;
height: 44px; margin-left: 12px;
margin-top: -5px;
margin-bottom: -5px;
li {
padding: 1px 4px;
border-radius: 3px;
font-size: 90%;
margin-right: 2px;
}
}
.card-controls {
display: flex;
margin-left: 12px;
margin-right: 12px;
& > div {
display: flex;
height: 44px;
}
}
}
.compact {
padding-bottom: 12px;
.labels {
height: 6px;
margin-top: -10px;
margin-bottom: 3px;
}
.labels li {
width: 30px;
height: 6px;
font-size: 0;
color: transparent;
} }
} }
</style> </style>

View File

@@ -65,7 +65,7 @@
<script> <script>
import { PopoverMenu } from 'nextcloud-vue' import { PopoverMenu } from 'nextcloud-vue'
import ClickOutside from 'vue-click-outside' import ClickOutside from 'vue-click-outside'
import ColorPicker from '../ColorPicker'; import ColorPicker from '../ColorPicker'
export default { export default {
name: 'AppNavigationBoard', name: 'AppNavigationBoard',
@@ -91,7 +91,7 @@ export default {
menuOpen: false, menuOpen: false,
undoTimeoutHandle: null, undoTimeoutHandle: null,
editTitle: '', editTitle: '',
editColor: '', editColor: ''
} }
}, },
computed: { computed: {

View File

@@ -47,6 +47,7 @@ export default new Vuex.Store({
strict: debug, strict: debug,
state: { state: {
navShown: true, navShown: true,
compactMode: false,
sidebarShown: false, sidebarShown: false,
currentBoard: null, currentBoard: null,
boards: [], boards: [],
@@ -117,6 +118,9 @@ export default new Vuex.Store({
toggleSidebar(state) { toggleSidebar(state) {
state.sidebarShown = !state.sidebarShown state.sidebarShown = !state.sidebarShown
}, },
toggleCompactMode(state) {
state.compactMode = !state.compactMode
},
setBoards(state, boards) { setBoards(state, boards) {
state.boards = boards state.boards = boards
}, },
@@ -199,6 +203,9 @@ export default new Vuex.Store({
toggleSidebar({ commit }) { toggleSidebar({ commit }) {
commit('toggleSidebar') commit('toggleSidebar')
}, },
toggleCompactMode({ commit }) {
commit('toggleCompactMode')
},
setCurrentBoard({ commit }, board) { setCurrentBoard({ commit }, board) {
commit('setCurrentBoard', board) commit('setCurrentBoard', board)
} }