Skip to content

Commit 8619239

Browse files
authored
feat: add sticky left nav (#1954)
1 parent 122a644 commit 8619239

File tree

5 files changed

+24
-19
lines changed

5 files changed

+24
-19
lines changed

apps/namadillo/src/App/Layout/AppHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const AppHeader = ({ burger }: { burger: ReactNode }): JSX.Element => {
1212
"grid gap-2",
1313
"grid-cols-[auto_auto] lg:grid-cols-[220px_auto]",
1414
"h-[80px] items-center",
15-
"px-6 sm:px-0"
15+
"px-6"
1616
)}
1717
>
1818
<div className="flex items-center gap-4">

apps/namadillo/src/App/Layout/AppLayout.tsx

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export const AppLayout = ({
1515

1616
return (
1717
<>
18-
<AlphaVersionTopHeader />
19-
<div className="custom-container pb-2">
18+
<div className="sticky top-0 bg-neutral-800 z-50">
19+
<AlphaVersionTopHeader />
2020
<AppHeader
2121
burger={
2222
<span className="sm:px-0 lg:hidden">
@@ -27,34 +27,39 @@ export const AppLayout = ({
2727
</span>
2828
}
2929
/>
30-
<div
30+
</div>
31+
<div className="lg:grid lg:grid-cols-[220px_auto] lg:gap-2 px-6">
32+
<aside
33+
onClick={(e) => e.stopPropagation()}
3134
className={twMerge(
32-
"grid lg:grid-cols-[220px_auto] lg:gap-2 min-h-[calc(100svh-95px)]"
35+
// mobile, burger, fixed, full height
36+
"transition-transform duration-500 ease-out-expo",
37+
"fixed left-0 top-0 bottom-0 z-[9999]",
38+
!displayNavigation && "-translate-x-full lg:translate-x-0",
39+
// desktop, left nav, floating panel - 112px is the header height
40+
"lg:sticky lg:top-[112px] lg:h-[calc(100svh-112px)] lg:pb-2",
41+
"lg:transition-none lg:z-auto"
3342
)}
3443
>
35-
<aside
36-
onClick={(e) => e.stopPropagation()}
44+
<div
3745
className={twMerge(
38-
"transition-transform duration-500 ease-out-expo",
39-
"pt-10 bg-black rounded-sm fixed top-0 z-[9999] w-[240px]",
40-
"h-svh lg:h-[calc(100svh-90px)] left-0 lg:z-0 lg:transition-none",
41-
"lg:pt-0 lg:w-auto lg:relative",
42-
!displayNavigation && "-translate-x-full lg:translate-x-0"
46+
"h-full bg-black w-[240px] pt-10",
47+
"lg:w-auto lg:p-0 lg:rounded-sm overflow-auto"
4348
)}
4449
>
4550
{displayNavigation && (
4651
<button
47-
className="absolute top-4 left-4 text-white hover:text-yellow text-2xl"
52+
className="absolute top-4 left-4 text-white hover:text-yellow text-2xl lg:hidden"
4853
onClick={() => setDisplayNavigation(false)}
4954
aria-label="Close Navigation"
5055
>
5156
<IoMdClose />
5257
</button>
5358
)}
5459
<Navigation />
55-
</aside>
56-
<main className="min-h-full">{children}</main>
57-
</div>
60+
</div>
61+
</aside>
62+
<main className="min-h-full pb-2">{children}</main>
5863
</div>
5964
</>
6065
);

apps/namadillo/src/App/Layout/Navigation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const Navigation = (): JSX.Element => {
6161
];
6262

6363
return (
64-
<div className="h-full flex flex-col justify-between flex-1 pt-6 pb-8 px-6">
64+
<div className="min-h-full flex flex-col justify-between gap-10 p-6 pb-8">
6565
<ul className="flex flex-col gap-4">
6666
{menuItems.map((item) => (
6767
<li key={item.label}>

apps/namadillo/src/App/Staking/MyValidatorsTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export const MyValidatorsTable = (): JSX.Element => {
107107

108108
return (
109109
<>
110-
<nav className="sm:absolute top-6 right-4 flex gap-2 flex-1 z-50">
110+
<nav className="sm:absolute top-6 right-4 flex gap-2 flex-1 z-10">
111111
<ActionButton
112112
className="basis-[content] py-1"
113113
backgroundColor="cyan"

apps/namadillo/src/App/Transactions/TransactionHistory.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const TransactionHistory = (): JSX.Element => {
1818

1919
return (
2020
<>
21-
<Panel className="flex flex-col gap-6 flex-1 h-full">
21+
<Panel className="flex flex-col gap-6 flex-1">
2222
<h2 className="mb-7">Transfers made by this device</h2>
2323
{pending.length > 0 && (
2424
<section>

0 commit comments

Comments
 (0)