File tree 2 files changed +53
-2
lines changed
packages/kolibri/components/pages/AppBarPage
2 files changed +53
-2
lines changed Original file line number Diff line number Diff line change 3
3
<!-- TODO useScrollPosition to set scrollPosition...
4
4
here or in router, but somewhere -->
5
5
<div class =" main" >
6
+ <div
7
+ v-if =" windowIsSmall"
8
+ ref =" swipeZone"
9
+ class =" swipe-zone"
10
+ ></div >
11
+
6
12
<ScrollingHeader :scrollPosition =" 0" >
7
13
<transition mode =" out-in" >
8
14
<AppBar
58
64
import commonCoreStrings from ' kolibri/uiText/commonCoreStrings' ;
59
65
import { isTouchDevice } from ' kolibri/utils/browserInfo' ;
60
66
import useUser from ' kolibri/composables/useUser' ;
67
+ import { ref , getCurrentInstance } from ' vue' ;
68
+ import { useSwipe } from ' @vueuse/core' ;
61
69
import ScrollingHeader from ' ../ScrollingHeader' ;
62
70
import AppBar from ' ./internal/AppBar' ;
63
71
import SideNav from ' ./internal/SideNav' ;
71
79
},
72
80
mixins: [commonCoreStrings],
73
81
setup () {
82
+ const instance = getCurrentInstance ();
83
+ const isRtl = ref (instance? .proxy .isRtl );
84
+ const swipeZone = ref (null );
85
+ const navShown = ref (false );
86
+ useSwipe (swipeZone, {
87
+ onSwipeEnd : (e , direction ) => {
88
+ if (direction === ' right' && ! navShown .value && ! isRtl .value ) {
89
+ navShown .value = true ;
90
+ } else if (direction === ' left' && ! navShown .value && isRtl .value ) {
91
+ navShown .value = true ;
92
+ }
93
+ },
94
+ });
74
95
const { windowIsSmall } = useKResponsiveWindow ();
75
96
const { isAppContext } = useUser ();
76
97
return {
77
98
windowIsSmall,
78
99
isAppContext,
100
+ swipeZone,
101
+ navShown,
79
102
};
80
103
},
81
104
props: {
102
125
data () {
103
126
return {
104
127
appBarHeight: 124 ,
105
- navShown: false ,
106
128
lastScrollTop: 0 ,
107
129
hideAppBars: true ,
108
130
throttledHandleScroll: null ,
222
244
background- color: white;
223
245
}
224
246
247
+ .swipe - zone {
248
+ position: fixed;
249
+ top: 0 ;
250
+ bottom: 0 ;
251
+ left: 0 ;
252
+ z- index: 5 ;
253
+ width: 30px ;
254
+ background: red;
255
+ opacity: 0 ;
256
+ }
257
+
225
258
< / style>
Original file line number Diff line number Diff line change 9
9
<transition :name =" showAppNavView ? 'bottom-nav' : 'side-nav'" >
10
10
<div
11
11
v-show =" navShown"
12
+ ref =" sideNavInside"
12
13
class =" side-nav"
13
14
:class =" showAppNavView ? 'bottom-offset' : ''"
14
15
:style =" {
266
267
import useNav from ' kolibri/composables/useNav' ;
267
268
import useUser from ' kolibri/composables/useUser' ;
268
269
import useUserSyncStatus from ' kolibri/composables/useUserSyncStatus' ;
270
+ import { useSwipe } from ' @vueuse/core' ;
271
+ import { ref , getCurrentInstance } from ' vue' ;
269
272
import SyncStatusDisplay from ' ../../../SyncStatusDisplay' ;
270
273
import LearnOnlyDeviceNotice from ' ./LearnOnlyDeviceNotice' ;
271
274
import TotalPoints from ' ./TotalPoints' ;
298
301
BottomNavigationBar,
299
302
},
300
303
mixins: [commonCoreStrings],
301
- setup () {
304
+ setup (props , { emit }) {
305
+ const instance = getCurrentInstance ();
306
+ const isRtl = instance? .proxy .isRtl ;
307
+
308
+ const sideNavInside = ref (null );
309
+ useSwipe (sideNavInside, {
310
+ threshold: 100 ,
311
+ onSwipeEnd : (e , direction ) => {
312
+ if (direction === ' left' && ! isRtl) {
313
+ emit (' toggleSideNav' );
314
+ } else if (direction === ' right' && isRtl) {
315
+ emit (' toggleSideNav' );
316
+ }
317
+ },
318
+ });
302
319
const { windowIsSmall , windowIsLarge } = useKResponsiveWindow ();
303
320
const {
304
321
canManageContent ,
330
347
userSyncStatus: status,
331
348
userLastSynced: lastSynced,
332
349
navItems,
350
+ sideNavInside,
333
351
};
334
352
},
335
353
props: {
You can’t perform that action at this time.
0 commit comments