Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

feat: make navigation view collapsable

thecodrre47f35eb05bc
diff --git a/apps/web/src/app.js b/apps/web/src/app.js
index 374582ff2..98d2009df 100644
--- a/apps/web/src/app.js
+++ b/apps/web/src/app.js
@@ -39,6 +39,7 @@ function getNavigationViewWidth() {
}
function App() {
const [selectedIndex, setSelectedIndex] = useState(0);
+ const [hideNavigationView, setHideNavigationView] = useState(false);
useEffect(() => {
RootNavigator.navigate("home");
}, []);
@@ -65,6 +66,10 @@ function App() {
if (item.onClick) {
return item.onClick();
}
+ if (selectedIndex === index) {
+ setHideNavigationView(!hideNavigationView);
+ return;
+ }
if (RootNavigator.navigate(item.key)) {
setSelectedIndex(index);
}
@@ -78,6 +83,9 @@ function App() {
<Flex flex="1 1 auto" flexDirection="row" alignContent="stretch" px={0}>
<Flex
className="RootNavigator"
+ style={{
+ display: hideNavigationView ? "none" : "flex"
+ }}
sx={{
borderRight: "1px solid",
borderColor: "border",
@@ -89,35 +97,37 @@ function App() {
flex="1 1 auto"
//style={{ width: "362px" }}
/>
- <Box
- className="resize-handle"
- bg="border"
- sx={{
- width: 5,
- opacity: 0,
- cursor: "col-resize"
- }}
- draggable={true}
- onMouseDown={e => {
- startX = e.clientX;
- let view = document
- .querySelector(".RootNavigator")
- .getBoundingClientRect();
- startWidth = parseInt(view.width, 10);
- }}
- onDrag={e => {
- let view = document.querySelector(".RootNavigator");
- view.style.width = `${startWidth + e.clientX - startX}px`;
- }}
- onDragEnd={e => {
- let view = document.querySelector(".RootNavigator");
- view.style.width = view.getBoundingClientRect().width;
- window.localStorage.setItem(
- "navigationViewWidth",
- view.style.width
- );
- }}
- />
+ {!hideNavigationView && (
+ <Box
+ className="resize-handle"
+ bg="border"
+ sx={{
+ width: 5,
+ opacity: 0,
+ cursor: "col-resize"
+ }}
+ draggable={true}
+ onMouseDown={e => {
+ startX = e.clientX;
+ let view = document
+ .querySelector(".RootNavigator")
+ .getBoundingClientRect();
+ startWidth = parseInt(view.width, 10);
+ }}
+ onDrag={e => {
+ let view = document.querySelector(".RootNavigator");
+ view.style.width = `${startWidth + e.clientX - startX}px`;
+ }}
+ onDragEnd={e => {
+ let view = document.querySelector(".RootNavigator");
+ view.style.width = view.getBoundingClientRect().width;
+ window.localStorage.setItem(
+ "navigationViewWidth",
+ view.style.width
+ );
+ }}
+ />
+ )}
<Editor />
</Flex>
<Box id="dialogContainer" />
diff --git a/apps/web/yarn.lock b/apps/web/yarn.lock
index c12b7bce5..201c66b80 100644
--- a/apps/web/yarn.lock
+++ b/apps/web/yarn.lock
@@ -6861,6 +6861,11 @@ node-fetch@^1.0.1:
encoding "^0.1.11"
is-stream "^1.0.1"
+node-fetch@^2.6.0:
+ version "2.6.0"
+ resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"
+ integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==
+
version "0.9.0"
resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.9.0.tgz#d624050edbb44874adca12bb9a52ec63cb782579"
@@ -6991,9 +6996,10 @@ normalize-url@^3.0.0, normalize-url@^3.0.1:
"notes-core@https://github.com/thecodrr/notes-core.git":
version "0.3.0"
- resolved "https://github.com/thecodrr/notes-core.git#5edc73b089e3b0fef585bf877f62feb4d49e2ff9"
+ resolved "https://github.com/thecodrr/notes-core.git#5093b6af27faa620c7dcb611c678041a4c024596"
dependencies:
fuzzysearch "^1.0.3"
+ node-fetch "^2.6.0"
transfun "^1.0.2"
npm-bundled@^1.0.1: