Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1475 Collapsable sidebar #1548

Merged
merged 10 commits into from
Oct 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 1 addition & 41 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@
"react-select-virtualized": "^3.5.0",
"react-shadow-root": "^6.1.0",
"react-spinners": "0.9.0",
"react-split-pane": "^0.1.92",
"react-table": "^7.7.0",
"react-toast-notifications": "^2.4.4",
"react-transition-group": "^4.4.2",
fregante marked this conversation as resolved.
Show resolved Hide resolved
"react-virtualized": "^9.22.3",
"react-virtualized-auto-sizer": "^1.0.6",
"react-window": "^1.8.6",
Expand Down
6 changes: 6 additions & 0 deletions src/devTools/Editor.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.root {
display: flex;
flex-direction: row;
height: 100%;
width: 100%;
}
30 changes: 10 additions & 20 deletions src/devTools/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { useCallback, useContext, useMemo } from "react";
import { Container } from "react-bootstrap";
import Sidebar from "@/devTools/editor/sidebar/Sidebar";
import { useDispatch, useSelector } from "react-redux";
import { RootState } from "@/devTools/store";
import SplitPane from "react-split-pane";
import { cancelSelectElement } from "@/background/devtools";
import { DevToolsContext } from "@/devTools/context";
import { selectExtensions } from "@/options/selectors";
Expand All @@ -37,11 +35,10 @@ import GenericInsertPane from "@/devTools/editor/panes/insert/GenericInsertPane"
import { ADAPTERS } from "@/devTools/editor/extensionPoints/adapter";
import { actions } from "@/devTools/editor/slices/editorSlice";
import { useGetMarketplaceListingsQuery } from "@/services/api";
import styles from "./Editor.module.scss";

const selectEditor = ({ editor }: RootState) => editor;

const DEFAULT_SIDEBAR_WIDTH_PX = 260;

const Editor: React.FunctionComponent = () => {
const { tabState, port, connecting } = useContext(DevToolsContext);
const installed = useSelector(selectExtensions);
Expand Down Expand Up @@ -141,22 +138,15 @@ const Editor: React.FunctionComponent = () => {
]);

return (
<Container fluid className="h-100">
<SplitPane
split="vertical"
allowResize
minSize={DEFAULT_SIDEBAR_WIDTH_PX}
defaultSize={DEFAULT_SIDEBAR_WIDTH_PX}
>
<Sidebar
installed={installed}
elements={elements}
activeElement={activeElement}
inserting={inserting}
/>
{body}
</SplitPane>
</Container>
<div className={styles.root}>
<Sidebar
installed={installed}
elements={elements}
activeElement={activeElement}
inserting={inserting}
/>
{body}
</div>
);
};

Expand Down
50 changes: 0 additions & 50 deletions src/devTools/Panel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
}

.container-fluid {
padding-left: 0;
padding-right: 0;
}

Expand All @@ -81,55 +80,6 @@
}
}

.Sidebar {
height: 100%;

border-right: 2px solid #c6bfdb;

&__extensions {
overflow-y: scroll;
}

.list-group {
border-radius: 0;

.list-group-item {
padding-left: 12px;
padding-right: 12px;
border-right: none;
font-size: 0.875rem;
}
}

&__actions {
.badge {
margin-top: -5px;
}
}

&__logo {
background-color: #6462aa; // Make logo icon look square
}
&__logo:hover {
filter: brightness(0.75);
}

&__actions button {
border-radius: 0;
margin-right: 0;
margin-left: 0;
}

label {
font-size: 0.875rem;
}

&__footer {
font-size: 0.875rem;
background-color: lightgray;
}
}

label.AutoRun {
font-size: 0.875rem;
}
Expand Down
2 changes: 1 addition & 1 deletion src/devTools/editor/ElementWizard.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

$nav-height: 32px;
$nav-height: 31px; // To match the height of the actions of the Sidebar

.nav {
height: $nav-height;
Expand Down
10 changes: 10 additions & 0 deletions src/devTools/editor/sidebar/Footer.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.root {
font-size: 0.875rem;
background-color: lightgray;
flex-grow: 0;
display: flex;
}

.scope {
flex: 1;
}
11 changes: 5 additions & 6 deletions src/devTools/editor/sidebar/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,18 @@ import React, { useContext } from "react";
import AuthContext from "@/auth/AuthContext";
import { DevToolsContext } from "@/devTools/context";
import BeatLoader from "react-spinners/BeatLoader";
import styles from "./Footer.module.scss";

const Footer: React.FunctionComponent = () => {
const { scope } = useContext(AuthContext);
const { connecting } = useContext(DevToolsContext);

return (
<div className="Sidebar__footer flex-grow-0">
<div className="d-flex">
<div className="flex-grow-1">
Scope: <code>{scope}</code>
</div>
<div>{connecting && <BeatLoader size={7} />}</div>
<div className={styles.root}>
<div className={styles.scope}>
Scope: <code>{scope}</code>
</div>
{connecting && <BeatLoader size={7} />}
</div>
);
};
Expand Down
96 changes: 96 additions & 0 deletions src/devTools/editor/sidebar/Sidebar.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
$logoSize: 31px;

.root {
flex-direction: column;
display: flex;
justify-content: flex-start;
height: 100%;
border-right: 2px solid #c6bfdb;

&.collapsed {
flex: 0 0 $logoSize;
align-items: center;
transition: transform 100ms;
}
&.expanded {
flex: 0 0 260px;
transition: transform 100ms;
}

&.hidden {
transform: translate3d(-100%, 0, 0);
}
&.hidden.showing {
transform: none;
}

label {
font-size: 0.875rem;
}

:global {
.list-group {
border-radius: 0;

.list-group-item {
padding-left: 12px;
padding-right: 12px;
border-right: none;
font-size: 0.875rem;
}
}
}
}

.logo {
background-color: #6462aa; // Make logo icon look square
width: $logoSize;
height: $logoSize;

&:hover {
filter: brightness(0.75);
}
}

.actions {
display: flex;
justify-content: space-between;

button {
border-radius: 0;
margin-right: 0;
margin-left: 0;
}

:global(.badge) {
margin-top: -5px;
}
}

.actionsLeft {
display: flex;
}

.toggle {
border-radius: 0 !important;
background-color: white !important;
&:hover {
background-color: #e9ecef !important;
}

.expanded & {
padding: 0 5px !important;
}
.collapsed & {
padding: 5px !important;
}
}

.unavailable {
margin: 5px;
}

.extensions {
overflow-y: scroll;
flex: 1;
}
Loading