database widget

This commit is contained in:
Jan Prochazka 2020-01-01 09:39:49 +01:00
parent 30af732820
commit 0dba0d3a68
3 changed files with 20 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import styled from 'styled-components';
import FilesTabsPanel from './FilesTabsPanel';
import WidgetIconPanel from './widgets/WidgetIconPanel';
import useCurrentWidget from './widgets/useCurrentWidget';
import WidgetContainer from './widgets/WidgetContainer';
const BodyDiv = styled.div`
position: fixed;
@ -59,7 +60,11 @@ export default function Screen({ children }) {
<IconBar>
<WidgetIconPanel />
</IconBar>
{!!currentWidget && <LeftPanel></LeftPanel>}
{!!currentWidget && (
<LeftPanel>
<WidgetContainer />
</LeftPanel>
)}
<TabsPanel leftPanelWidth={leftPanelWidth}>
<FilesTabsPanel></FilesTabsPanel>
</TabsPanel>

View File

@ -0,0 +1,5 @@
import React from 'react';
export default function DatabaseWidget() {
return <button onClick={() => {}}>Add connection</button>;
}

View File

@ -0,0 +1,9 @@
import React from 'react';
import useCurrentWidget from './useCurrentWidget';
import DatabaseWidget from './DatabaseWidget';
export default function WidgetContainer() {
const currentWidget = useCurrentWidget();
if (currentWidget === 'database') return <DatabaseWidget />;
return null;
}