Skip to content

Commit 10d05ea

Browse files
committed
Added a new drawer example in the documentation.
1 parent d11221c commit 10d05ea

File tree

1 file changed

+71
-1
lines changed

1 file changed

+71
-1
lines changed

src/views/documentation.vue

+71-1
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@
495495
a(href="#toggle-a-pane-with-v-if") Toggle a pane with #[span.code v-if]
496496

497497
w-button.mb2(@click="hidePane2 = !hidePane2")
498-
w-icon.mr2 mdi mdi-{{ hidePane2 ? 'eye' : 'eye-off'}}
498+
w-icon.mr2 mdi mdi-{{ hidePane2 ? 'eye' : 'eye-off' }}
499499
| {{ hidePane2 ? 'Show' : 'Hide' }} Pane 2
500500
splitpanes.default-theme.example(style="height: 400px")
501501
pane
@@ -519,6 +519,56 @@
519519
</pane>
520520
</splitpanes>
521521

522+
//- Example.
523+
h3.mt12.pt8.mb2(id="resizable-drawer")
524+
a(href="#resizable-drawer") Resizable Drawer
525+
526+
p.
527+
Sometimes, you need a resizable drawer that goes on top of your app.#[br]
528+
Here's one way to do this, mostly thanks to CSS powers. The key here is to set the Splitpanes
529+
container to #[code pointer-events: none;] and reactivate the pointer events in the splitter and drawer
530+
so that you can click through Splitpanes on the rest of the page.
531+
532+
w-button.mb2(@click="showDrawer = !showDrawer")
533+
w-icon.mr2 mdi mdi-{{ showDrawer ? 'eye' : 'eye-off' }}
534+
| {{ showDrawer ? 'Hide' : 'Show' }} Drawer
535+
splitpanes.default-theme.example.example--drawer(v-if="showDrawer")
536+
pane
537+
pane.drawer(size="40")
538+
h3.mt12 Resizable Drawer
539+
540+
ssh-pre(language="html-vue" label="HTML").
541+
<button @click="showDrawer = !showDrawer">
542+
{{ "\{\{ showDrawer ? 'Hide' : 'Show' \}\}" }} Drawer
543+
</button>
544+
545+
<splitpanes v-if="showDrawer" class="default-theme">
546+
<pane></pane>
547+
<pane size="40">
548+
<h3>Resizable Drawer</h3>
549+
</pane>
550+
</splitpanes>
551+
552+
ssh-pre(language="css" label="CSS").
553+
.splitpanes {
554+
position: fixed;
555+
inset: 0 0 0 auto;
556+
z-index: 100;
557+
pointer-events: none;
558+
559+
.splitpanes__pane:first-child {background-color: transparent;}
560+
.splitpanes__splitter {pointer-events: all;}
561+
562+
.splitpanes__pane ~ .splitpanes__pane {
563+
pointer-events: all;
564+
background-color: #fff;
565+
box-shadow: none;
566+
align-items: flex-start;
567+
overflow: hidden;
568+
white-space: nowrap;
569+
}
570+
}
571+
522572
//- Example.
523573
h3.mt12.pt8.mb2(id="vue-router")
524574
a(href="#vue-router") Vue Router inside splitpanes
@@ -864,6 +914,7 @@ const paneSize = ref(50)
864914
const hidePane2 = ref(false)
865915
const horizontal = ref(false)
866916
const firstSplitter = ref(false)
917+
const showDrawer = ref(false)
867918
868919
const panesNumberAbs = computed(() => {
869920
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
@@ -1020,6 +1071,25 @@ em.specs {
10201071
}
10211072
}
10221073
1074+
.example.example--drawer {
1075+
position: fixed;
1076+
inset: 0 0 0 auto;
1077+
z-index: 100;
1078+
pointer-events: none;
1079+
1080+
.splitpanes__pane:first-child {background-color: transparent;}
1081+
.splitpanes__splitter {pointer-events: all;}
1082+
1083+
.splitpanes__pane.drawer {
1084+
pointer-events: all;
1085+
background-color: #fff;
1086+
box-shadow: none;
1087+
align-items: flex-start;
1088+
overflow: hidden;
1089+
white-space: nowrap;
1090+
}
1091+
}
1092+
10231093
// In order to showcase the synchronicity with the panes.
10241094
div.w-slider__thumb, div.w-slider__range {transition: none;}
10251095
.example--programmatic-resizing .splitpanes__pane {transition: none;}

0 commit comments

Comments
 (0)