2021-07-28 16:15:52 +03:00
|
|
|
import React, { useState, useEffect } from 'react';
|
|
|
|
import './Drawer.scss';
|
|
|
|
|
|
|
|
import cons from '../../../client/state/cons';
|
|
|
|
import navigation from '../../../client/state/navigation';
|
|
|
|
|
|
|
|
import ScrollView from '../../atoms/scroll/ScrollView';
|
|
|
|
|
2021-08-30 18:42:24 +03:00
|
|
|
import DrawerHeader from './DrawerHeader';
|
|
|
|
import Home from './Home';
|
|
|
|
import Directs from './Directs';
|
2021-07-28 16:15:52 +03:00
|
|
|
|
|
|
|
function DrawerBradcrumb() {
|
|
|
|
return (
|
|
|
|
<div className="breadcrumb__wrapper">
|
|
|
|
<ScrollView horizontal vertical={false}>
|
|
|
|
<div>
|
|
|
|
{/* TODO: bradcrumb space paths when spaces become a thing */}
|
|
|
|
</div>
|
|
|
|
</ScrollView>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-08-30 06:01:13 +03:00
|
|
|
function Drawer() {
|
|
|
|
const [activeTab, setActiveTab] = useState('home');
|
|
|
|
|
|
|
|
function onTabChanged(tabId) {
|
|
|
|
setActiveTab(tabId);
|
|
|
|
}
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
navigation.on(cons.events.navigation.TAB_CHANGED, onTabChanged);
|
|
|
|
return () => {
|
|
|
|
navigation.removeListener(cons.events.navigation.TAB_CHANGED, onTabChanged);
|
|
|
|
};
|
|
|
|
}, []);
|
2021-07-28 16:15:52 +03:00
|
|
|
return (
|
|
|
|
<div className="drawer">
|
2021-08-30 06:01:13 +03:00
|
|
|
<DrawerHeader activeTab={activeTab} />
|
2021-07-28 16:15:52 +03:00
|
|
|
<div className="drawer__content-wrapper">
|
|
|
|
<DrawerBradcrumb />
|
2021-08-31 16:13:31 +03:00
|
|
|
<div className="rooms__wrapper">
|
2021-07-28 16:15:52 +03:00
|
|
|
<ScrollView autoHide>
|
2021-08-31 16:13:31 +03:00
|
|
|
<div className="rooms-container">
|
2021-08-30 18:42:24 +03:00
|
|
|
{
|
|
|
|
activeTab === 'home'
|
|
|
|
? <Home />
|
|
|
|
: <Directs />
|
|
|
|
}
|
|
|
|
</div>
|
2021-07-28 16:15:52 +03:00
|
|
|
</ScrollView>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Drawer;
|