Skip to content

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

feat: save resized width in localStorage

thecodrra1861153a00f
diff --git a/apps/web/src/app.js b/apps/web/src/app.js
index 193440e1b..315d4469d 100644
--- a/apps/web/src/app.js
+++ b/apps/web/src/app.js
@@ -37,6 +37,9 @@ const NavMenuItem = props => {
);
};
var startX, startWidth;
+function getNavigationViewWidth() {
+ return window.localStorage.getItem("navigationViewWidth");
+}
function App() {
const [selectedIndex, setSelectedIndex] = useState(1);
return (
@@ -74,13 +77,15 @@ function App() {
className="navigationView"
sx={{
borderRight: "1px solid",
- borderColor: "border"
+ borderColor: "border",
+ width: !getNavigationViewWidth()
+ ? ["100%", "40%", "15%"]
+ : getNavigationViewWidth()
}}
flexDirection="column"
flex="1 1 auto"
px={2}
py={2}
- width={["100%", "40%", "15%"]}
//style={{ width: "362px" }}
/>
<Box
@@ -101,6 +106,13 @@ function App() {
let view = document.querySelector(".navigationView");
view.style.width = `${startWidth + e.clientX - startX}px`;
}}
+ onDragEnd={e => {
+ let view = document.querySelector(".navigationView");
+ window.localStorage.setItem(
+ "navigationViewWidth",
+ view.style.width
+ );
+ }}
/>
<Editor />
<Flex