Edge drag detection for menu
This commit is contained in:
@@ -24,7 +24,10 @@ There are currently snippets for the following common mobile components:
|
|||||||
- [x] Content
|
- [x] Content
|
||||||
- [x] Tabs
|
- [x] Tabs
|
||||||
- [ ] Nav (in progress)
|
- [ ] Nav (in progress)
|
||||||
|
- [x] Icon
|
||||||
- [x] Menu
|
- [x] Menu
|
||||||
- [x] Modal
|
- [x] Modal
|
||||||
- [ ] Dialog
|
- [ ] Dialog
|
||||||
- [ ] Card
|
- [x] Button
|
||||||
|
- [x] Card
|
||||||
|
- [x] Safe Area
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
const App = ({ children }) => (
|
import classNames from 'classnames';
|
||||||
<div className="flex h-screen flex-col">
|
|
||||||
|
const App = ({ children, className, ...props }) => (
|
||||||
|
<div {...props} className={classNames('flex h-screen flex-col', className)}>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
+8
-2
@@ -135,9 +135,15 @@ export default function Index() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// To enable edge drag detection to open the side menu
|
||||||
const bind = useDrag(
|
const bind = useDrag(
|
||||||
({ down, movement: [mx] }) => {
|
({ down, movement: [mx], xy: [x, y], cancel }) => {
|
||||||
console.log('DRAGGING SIDE', mx);
|
if (mx > 5 && x < 50 && down) {
|
||||||
|
Store.update(s => {
|
||||||
|
s.showMenu = true;
|
||||||
|
});
|
||||||
|
cancel();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
axis: 'x',
|
axis: 'x',
|
||||||
|
|||||||
Reference in New Issue
Block a user