Skip to content

Commit 7635b2e

Browse files
committed
add horizontal-split option
1 parent ff13a56 commit 7635b2e

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

src/components/NcAppContent/NcAppContent.vue

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,23 @@ The list size must be between the min and the max width value.
6060

6161
<template v-if="hasList">
6262
<!-- Mobile view does not allow resizeable panes -->
63-
<div v-if="isMobile || layout === 'no-split'"
63+
<div v-if="(isMobile && mobileLayout === 'no-split') || layout === 'no-split' "
6464
class="app-content-wrapper app-content-wrapper--no-split"
6565
:class="{
6666
'app-content-wrapper--show-details': showDetails,
6767
'app-content-wrapper--show-list': !showDetails,
68-
'app-content-wrapper--mobile': isMobile,}">
68+
'app-content-wrapper--mobile': isMobile}">
6969
<NcAppDetailsToggle v-if="showDetails" @click.native.stop.prevent="hideDetails" />
7070
<slot v-if="!showDetails" name="list" />
7171

7272
<slot v-else />
7373
</div>
7474
<div v-else-if="layout === 'vertical-split' || layout === 'horizontal-split'" class="app-content-wrapper">
75-
<Splitpanes :horizontal="layout === 'horizontal-split'"
75+
<Splitpanes :horizontal="layout === 'horizontal-split' || (isMobile && mobileLayout === 'horizontal-split')"
7676
class="default-theme"
77-
:class="{ 'splitpanes--horizontal': layout === 'horizontal-split',
78-
'splitpanes--vertical': layout === 'vertical-split'
77+
:class="{ 'splitpanes--horizontal': layout === 'horizontal-split' || (isMobile && mobileLayout === 'horizontal-split') ,
78+
'splitpanes--vertical': layout === 'vertical-split',
79+
'splitpanes--horizontal-mobile': mobileLayout == 'horizontal-split'
7980
}"
8081
:rtl="isRTL"
8182
@resized="handlePaneResize">
@@ -175,7 +176,7 @@ export default {
175176
},
176177

177178
/**
178-
* When in mobile view, only the list or the details are shown
179+
* When in 'no-split' mobile view, only the list or the details are shown
179180
* If you provide a list, you need to provide a variable
180181
* that will be set to true by the user when an element of
181182
* the list gets selected. The details will then show a back
@@ -208,12 +209,14 @@ export default {
208209
},
209210
/**
210211
* Content layout used on mobile.
212+
* - `no-split` - a single column layout; List is shown when `showDetails` is `false`, otherwise the default slot content is shown with a back button to return to the list.
213+
* - 'horizontal-split' - a 2-column layout with list and default content separated horizontally
211214
*/
212215
mobileLayout: {
213216
type: String,
214217
default: 'no-split',
215218
validator(value) {
216-
return ['no-split'].includes(value)
219+
return ['no-split', 'horizontal-split'].includes(value)
217220
}
218221
}
219222
},
@@ -409,6 +412,22 @@ export default {
409412
scrollbar-width: auto;
410413
}
411414

415+
&:not(.splitpanes--horizontal-mobile) {
416+
.splitpanes__pane-list{
417+
@media only screen and (width < $breakpoint-mobile) {
418+
display: none;
419+
}
420+
}
421+
}
422+
423+
&.splitpanes--horizontal-mobile {
424+
.splitpanes__pane-details{
425+
@media only screen and (width < $breakpoint-mobile) {
426+
min-height:30%;
427+
}
428+
}
429+
}
430+
412431
.splitpanes__pane {
413432
background-color: transparent;
414433
transition: none;
@@ -417,9 +436,7 @@ export default {
417436
min-width: 300px;
418437
position: sticky;
419438

420-
@media only screen and (width < $breakpoint-mobile) {
421-
display: none;
422-
}
439+
423440
}
424441

425442
&-details {

0 commit comments

Comments
 (0)