Improved section and widget layout for Minimal view

This commit is contained in:
Alicia Sykes 2022-01-22 20:44:31 +00:00
parent 4278764101
commit 25bc577fb1
3 changed files with 31 additions and 7 deletions

View File

@ -1,24 +1,33 @@
<template> <template>
<div <div
@click="selectSection(index)" @click="selectSection(index)" v-tooltip="tooltip()"
:class="`minimal-section-heading ${selected ? 'selected' : ''}`"> v-bind:class="{ selected: selected, 'minimal-section-heading': true, center: hideTitleText }">
<h3>{{ title }}</h3> <Icon v-if="icon" :icon="icon" size="small" class="section-icon" />
<h3 class="section-title" v-if="!hideTitleText">{{ title }}</h3>
</div> </div>
</template> </template>
<script> <script>
import Icon from '@/components/LinkItems/ItemIcon.vue';
export default { export default {
name: 'MinimalHeadings', name: 'MinimalHeadings',
components: { Icon },
props: { props: {
index: Number, index: Number,
title: String, title: String,
icon: String,
selected: Boolean, selected: Boolean,
hideTitleText: Boolean,
}, },
methods: { methods: {
selectSection(index) { selectSection(index) {
this.$emit('sectionSelected', index); this.$emit('sectionSelected', index);
}, },
tooltip() {
return this.hideTitleText
? { content: this.title, trigger: 'hover focus', delay: 250 } : null;
},
}, },
}; };
</script> </script>
@ -28,23 +37,33 @@ export default {
@import '@/styles/style-helpers.scss'; @import '@/styles/style-helpers.scss';
div.minimal-section-heading { div.minimal-section-heading {
display: flex;
cursor: pointer; cursor: pointer;
padding: 0.5rem 0.25rem;
margin-bottom: 0; margin-bottom: 0;
padding: 0.5rem 0.25rem;
justify-content: flex-start;
align-items: center;
background: var(--minimal-view-section-heading-background); background: var(--minimal-view-section-heading-background);
border: 1px solid var(--minimal-view-section-heading-color); border: 1px solid var(--minimal-view-section-heading-color);
border-bottom: none; border-bottom: none;
border-radius: var(--curve-factor) var(--curve-factor) 0 0; border-radius: var(--curve-factor) var(--curve-factor) 0 0;
h3 { h3.section-title {
margin: 0; margin: 0;
color: var(--minimal-view-section-heading-color); color: var(--minimal-view-section-heading-color);
} }
.section-icon {
color: var(--minimal-view-section-heading-color);
margin-right: 0.2rem;
}
&.selected { &.selected {
background: var(--minimal-view-section-heading-color); background: var(--minimal-view-section-heading-color);
h3 { h3.section-title, .section-icon {
color: var(--minimal-view-section-heading-background); color: var(--minimal-view-section-heading-background);
} }
} }
&.center {
justify-content: center;
}
} }
</style> </style>

View File

@ -22,7 +22,7 @@
@triggerModal="triggerModal" @triggerModal="triggerModal"
/> />
</div> </div>
<div v-if="widgets && (selected || showAll)"> <div v-if="widgets && (selected && !showAll)" class="minimal-widget-wrap">
<WidgetBase <WidgetBase
v-for="(widget, widgetIndx) in widgets" v-for="(widget, widgetIndx) in widgets"
:key="widgetIndx" :key="widgetIndx"
@ -125,6 +125,9 @@ export default {
@include big-screen-up { --minimal-col-count: 6; } @include big-screen-up { --minimal-col-count: 6; }
grid-template-columns: repeat(var(--minimal-col-count, 1), minmax(0, 1fr)); grid-template-columns: repeat(var(--minimal-col-count, 1), minmax(0, 1fr));
} }
.minimal-widget-wrap {
padding: 1rem;
}
&.selected { &.selected {
border: 1px solid var(--minimal-view-group-color); border: 1px solid var(--minimal-view-group-color);
grid-column-start: span var(--col-count, 3); grid-column-start: span var(--col-count, 3);

View File

@ -21,9 +21,11 @@
:key="`heading-${index}`" :key="`heading-${index}`"
:index="index" :index="index"
:title="section.name" :title="section.name"
:icon="section.icon"
:selected="selectedSection === index" :selected="selectedSection === index"
@sectionSelected="sectionSelected" @sectionSelected="sectionSelected"
class="headings" class="headings"
:hideTitleText="sections.length > 8"
/> />
<!-- Section item groups --> <!-- Section item groups -->
<MinimalSection <MinimalSection