Skip to content

Commit

Permalink
Nav Bar Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Crazypkr1099 committed Sep 6, 2023
1 parent 525c428 commit 6e0469d
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions packages/desktop-client/src/components/FinancesApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,41 @@ function NarrowNotSupported({
children: ReactElement;
}) {
const { isNarrowWidth } = useResponsive();
const { isExtraSmallWidth } = useResponsive();
let isWidth = false;

if (isNarrowWidth || isExtraSmallWidth) {
isWidth = true;
} else {
isWidth = false;
}

const navigate = useNavigate();
useEffect(() => {
if (isNarrowWidth) {
if (isWidth) {
navigate(redirectTo);
}
}, [isNarrowWidth, navigate, redirectTo]);
return isNarrowWidth ? null : children;
}, [isWidth, navigate, redirectTo]);
return isWidth ? null : children;
}

function WideNotSupported({ children, redirectTo = '/budget' }) {
const { isNarrowWidth } = useResponsive();
const { isExtraSmallWidth } = useResponsive();
let isWidth = false;

if (isNarrowWidth || isExtraSmallWidth) {
isWidth = true;
} else {
isWidth = false;
}
const navigate = useNavigate();
useEffect(() => {
if (!isNarrowWidth) {
if (!isWidth) {
navigate(redirectTo);
}
}, [isNarrowWidth, navigate, redirectTo]);
return isNarrowWidth ? children : null;
}, [isWidth, navigate, redirectTo]);
return isWidth ? children : null;
}

function NavTab({ icon: TabIcon, name, path }) {
Expand All @@ -93,14 +110,22 @@ function NavTab({ icon: TabIcon, name, path }) {

function MobileNavTabs() {
const { isNarrowWidth } = useResponsive();
const { isExtraSmallWidth } = useResponsive();
let isWidth = false;

if (isNarrowWidth || isExtraSmallWidth) {
isWidth = true;
} else {
isWidth = false;
}
return (
<div
style={{
backgroundColor: theme.mobileNavBackground,
borderTop: `1px solid ${theme.menuBorder}`,
bottom: 0,
...styles.shadow,
display: isNarrowWidth ? 'flex' : 'none',
display: isWidth ? 'flex' : 'none',
height: '80px',
justifyContent: 'space-around',
paddingTop: 10,
Expand Down

0 comments on commit 6e0469d

Please sign in to comment.