From 15987abe0a364719035511d30675399cd8377efc Mon Sep 17 00:00:00 2001 From: Danny Avila <110412045+danny-avila@users.noreply.github.com> Date: Sat, 15 Jul 2023 10:43:15 -0400 Subject: [PATCH] style(Nav): improve Nav transition for open/close (#652) * Revert "Animated sidebar (#649)" This reverts commit dd19323280841a2180f829c0a6764759e7acb58f. * in progress * style(Nav): improve transition for Nav --- client/src/components/Nav/MobileNav.jsx | 2 +- client/src/components/Nav/index.jsx | 166 +++++++----------- .../components/svg/{Panel.jsx => Panel.tsx} | 0 client/src/components/svg/index.ts | 1 + client/src/mobile.css | 29 +-- 5 files changed, 74 insertions(+), 124 deletions(-) rename client/src/components/svg/{Panel.jsx => Panel.tsx} (100%) diff --git a/client/src/components/Nav/MobileNav.jsx b/client/src/components/Nav/MobileNav.jsx index c619588ad5..5fa891b2e8 100644 --- a/client/src/components/Nav/MobileNav.jsx +++ b/client/src/components/Nav/MobileNav.jsx @@ -12,7 +12,7 @@ export default function MobileNav({ setNavVisible }) {
-
-
setIsHovering(true)} - onMouseLeave={() => setIsHovering(false)} - ref={containerRef} - > -
- {(getConversationsQuery.isLoading && pageNumber === 1) || isFetching ? ( - - ) : ( - - )} - +
+
+
+
- - +
setIsHovering(true)} + onMouseLeave={() => setIsHovering(false)} + ref={containerRef} + > +
+ {(getConversationsQuery.isLoading && pageNumber === 1) || isFetching ? ( + + ) : ( + + )} + +
+
+ + +
{!navVisible && ( - +
+ +
)}
diff --git a/client/src/components/svg/Panel.jsx b/client/src/components/svg/Panel.tsx similarity index 100% rename from client/src/components/svg/Panel.jsx rename to client/src/components/svg/Panel.tsx diff --git a/client/src/components/svg/index.ts b/client/src/components/svg/index.ts index 8487f935e2..1ce48d8664 100644 --- a/client/src/components/svg/index.ts +++ b/client/src/components/svg/index.ts @@ -1,6 +1,7 @@ export { default as Plugin } from './Plugin'; export { default as GPTIcon } from './GPTIcon'; export { default as CogIcon } from './CogIcon'; +export { default as Panel } from './Panel'; export { default as Spinner } from './Spinner'; export { default as MessagesSquared } from './MessagesSquared'; export { default as StopGeneratingIcon } from './StopGeneratingIcon'; diff --git a/client/src/mobile.css b/client/src/mobile.css index 305c7c2bf0..f1a5b4deb5 100644 --- a/client/src/mobile.css +++ b/client/src/mobile.css @@ -3,11 +3,6 @@ visibility: visible; } -.nav-open-button { - display: block; - position: absolute; -} - .nav-close-button { margin-left: 8px; } @@ -15,11 +10,9 @@ .nav { position: fixed; z-index: 40; - left: calc(-100%); top: 0; - width: calc(100% - 60px); - max-width: 260px; + /* max-width: 260px; */ bottom: 0; opacity: 0; @@ -27,20 +20,10 @@ .nav.active { position: relative; - animation: nav-open 1000ms ease-in-out forwards; left: 0; opacity: 1; } -@keyframes nav-open { - 0% { - width: 0%; - } - 100%{ - width: 100%; - } -} - .nav-mask.active { opacity: 1; pointer-events: auto; @@ -48,9 +31,9 @@ @media (max-width: 767px) { .nav { - width: calc(100% - 60px); + width: calc(100% - 10px) ; + transition: all 0.2s; } - .nav-mask { position: fixed; z-index: 35; @@ -62,9 +45,14 @@ padding-left: 420px; padding-top: 12px; opacity: 0; + transition: all 0.5s; pointer-events: none; } + .nav-open-button { + opacity: 0; + } + .nav-mask.active { opacity: 1; pointer-events: auto; @@ -72,7 +60,6 @@ .nav.active { position: fixed; - animation: none; } }