Skip to content

Commit 826a9b7

Browse files
hide left panel
1 parent 3e75fd6 commit 826a9b7

File tree

8 files changed

+78
-21
lines changed

8 files changed

+78
-21
lines changed

src/containers/layout/Layout.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,19 @@ import "./layout.scss";
33
import LeftPanel from "../sidepanel/LeftPanel";
44
import QueryTabsContainer from "../query-tabs/QueryTabsContainer";
55
import QueryProvider from "../../providers/QueryProvider";
6+
import { useEffect, useState } from "react";
67
const Layout: React.FC = () => {
8+
const [leftPanelOpen, setLeftPanelOpen] = useState(true);
9+
useEffect(() => {
10+
setTimeout(() => {
11+
window.dispatchEvent(new Event("resize"));
12+
}, 600);
13+
}, [leftPanelOpen]);
714
return (
815
<QueryProvider>
916
<div className={"AppLayoutContainer"}>
10-
<LeftPanel />
11-
<QueryTabsContainer />
17+
<LeftPanel open={leftPanelOpen} setOpen={setLeftPanelOpen} />
18+
<QueryTabsContainer leftPanelOpen={leftPanelOpen} />
1219
</div>
1320
</QueryProvider>
1421
);

src/containers/layout/layout.scss

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,5 @@
55
vertical-align: top;
66
overflow-y: auto;
77
white-space: normal;
8-
9-
&:nth-child(1) {
10-
width: 400px;
11-
padding: 20px;
12-
height: 100vh;
13-
overflow-y: auto;
14-
position: fixed;
15-
}
16-
&:nth-child(2) {
17-
padding-left: 400px;
18-
width: 100%; //calc(100vw - 450px);
19-
}
208
}
219
}

src/containers/query-tabs/QueryTabsContainer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ import { useContext } from "react";
44
import { QueryContext } from "../../providers/QueryProvider";
55
import FrameCypherEditor from "../frame/FrameCypherEditor";
66

7-
function QueryTabsContainer() {
7+
function QueryTabsContainer({ leftPanelOpen }: { leftPanelOpen: boolean }) {
88
const {
99
current: { queries, addQuery: addQueryFrame, onQueryDelete },
1010
history: { addQuery },
1111
} = useContext(QueryContext);
1212

1313
return (
14-
<div className={"resultContainer"}>
14+
<div className={`resultContainer${leftPanelOpen ? "" : " large"}`}>
1515
<div className={"box block"}>
1616
<FrameCypherEditor onSubmit={addQueryFrame} />
1717
</div>
1818
{queries.map((t) => (
19-
<div key={t.id} className={"box block"}>
19+
<div key={t.id} className={"box no-shadow"}>
2020
<FrameContainer
2121
query={t}
2222
cacheQuery={addQuery}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
11
.resultContainer {
22
min-height: 100vh;
3+
padding-left: 400px;
4+
width: 100%; //calc(100vw - 450px);
5+
6+
transition: padding-left 0.4s ease-in-out;
7+
8+
&.large {
9+
padding-left: 70px;
10+
}
11+
12+
.no-shadow {
13+
box-shadow: initial;
14+
}
315
}

src/containers/schema/SchemaInfoContainer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const SchemaInfoContainer: FC = () => {
77
<div className={"schemaInfo block"}>
88
<div className={"block"}>
99
<div className={"title has-text-primary-10-invert"}>Labels</div>
10-
<div>
10+
<div className={"is-overflow-y-scroll scroll"}>
1111
{schema.labels?.map((t) => (
1212
<div className={"tag is-dark"} key={t}>
1313
{t}
@@ -17,7 +17,7 @@ const SchemaInfoContainer: FC = () => {
1717
</div>
1818
<div className={"block"}>
1919
<div className={"title has-text-primary-10-invert"}>Relationships</div>
20-
<div>
20+
<div className={"is-overflow-y-scroll scroll"}>
2121
{schema.relationshipTypes?.map((t) => (
2222
<div className={"tag is-dark"} key={t}>
2323
{t}

src/containers/schema/schemaInfo.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
.tag {
33
margin: 2px 5px 2px 0;
44
}
5+
.scroll {
6+
max-height: 400px;
7+
}
58
}

src/containers/sidepanel/LeftPanel.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,28 @@ import ConnectionStatusSidepanel from "../connection-status-sidepanel/Connection
44
import SavedQueriesContainer from "../saved-queries/SavedQueriesContainer";
55
import DatabaseContainer from "../database/DatabaseContainer";
66
import SchemaInfoContainer from "../schema/SchemaInfoContainer";
7-
const LeftPanel: React.FC = () => {
7+
import { Dispatch, SetStateAction, useCallback } from "react";
8+
const LeftPanel: React.FC<{
9+
open: boolean;
10+
setOpen: Dispatch<SetStateAction<boolean>>;
11+
}> = ({ open, setOpen }) => {
812
return (
913
<div
1014
className={
11-
"leftPanel has-background-primary-05 has-text-primary-20-invert"
15+
"leftPanel has-background-primary-05 has-text-primary-20-invert" +
16+
(open ? "" : " closed")
1217
}
1318
>
19+
<div
20+
className="open-container"
21+
onClick={useCallback(() => {
22+
setOpen((t) => !t);
23+
}, [setOpen])}
24+
>
25+
<span className="icon is-medium">
26+
<i className={`fas fa-chevron-${open ? "left" : "right"}`}></i>
27+
</span>
28+
</div>
1429
<DatabaseContainer />
1530
<SavedQueriesContainer />
1631
<SchemaInfoContainer />
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
.leftPanel {
2+
width: 400px;
3+
padding: 20px;
4+
height: 100vh;
5+
overflow-y: auto;
6+
position: fixed;
7+
left: 0;
8+
9+
transition: left 0.4s ease-in-out;
10+
&.closed {
11+
left: -330px;
12+
13+
> * {
14+
display: none;
15+
16+
&.open-container {
17+
display: initial;
18+
}
19+
}
20+
}
21+
22+
.open-container {
23+
background-color: dodgerblue;
24+
display: inline-block;
25+
position: absolute;
26+
right: 20px;
27+
color: white;
28+
padding: 2px;
29+
border-radius: 50%;
30+
cursor: pointer;
31+
}
32+
}

0 commit comments

Comments
 (0)