Skip to content

Commit f2fd3a1

Browse files
committed
update
1 parent ebb31b1 commit f2fd3a1

File tree

1 file changed

+71
-27
lines changed

1 file changed

+71
-27
lines changed

app/routes/bible.tsx

Lines changed: 71 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { json } from "@remix-run/node";
33
import { Form, Link, NavLink, Outlet, useLoaderData } from "@remix-run/react";
44
import { requireUserId } from "~/session.server";
55
import { useUser } from "~/utils";
6+
import React, { useState } from 'react';
67

78
export const loader = async ({ request }: LoaderFunctionArgs) => {
89
const userId = await requireUserId(request);
@@ -12,38 +13,81 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
1213
export default function BiblePage() {
1314
const data = useLoaderData<typeof loader>();
1415
const user = useUser();
16+
const [isSidebarOpen, setIsSidebarOpen] = useState(false);
1517

1618
return (
1719
<div className="flex h-full min-h-screen flex-col">
18-
<main className="flex h-full bg-white">
19-
<div className="h-full w-80 border-r bg-gray-50">
20-
<hr />
21-
22-
<ol>
23-
<li>
24-
<NavLink
25-
className={({ isActive }) =>
26-
`block border-b p-4 text-xl ${isActive ? "bg-white" : ""}`
27-
}
28-
to="old-testament"
29-
>
30-
📖 Old Testament
31-
</NavLink>
32-
</li>
33-
<li>
34-
<NavLink
35-
className={({ isActive }) =>
36-
`block border-b p-4 text-xl ${isActive ? "bg-white" : ""}`
37-
}
38-
to="new-testament"
39-
>
40-
📖 New Testament
41-
</NavLink>
42-
</li>
43-
</ol>
20+
{/* Main container with padding-top to account for header */}
21+
<main className="flex-1 flex flex-col md:flex-row-reverse h-full bg-white" style={{ paddingTop: '64px' }}>
22+
{/* Hamburger menu button for mobile only, positioned below header on the right, hides when sidebar is open */}
23+
{!isSidebarOpen && (
24+
<button
25+
onClick={() => setIsSidebarOpen(true)}
26+
className="md:hidden fixed top-16 right-4 z-50 p-4 text-blue-500 focus:outline-none"
27+
>
28+
<svg className="h-6 w-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
29+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M4 6h16M4 12h16m-7 6h7" />
30+
</svg>
31+
</button>
32+
)}
33+
34+
{/* Sidebar for Bible sections - hidden on mobile by default, fixed width on desktop, now on the right */}
35+
<div className={`
36+
fixed inset-y-0 right-0 transform ${isSidebarOpen ? 'translate-x-0' : 'translate-x-full'}
37+
md:relative md:translate-x-0 md:flex md:w-80 md:border-l md:bg-gray-50 md:shadow
38+
transition-transform duration-300 ease-in-out z-40
39+
h-full
40+
`} style={{ top: '64px', boxShadow: '-2px 0 5px rgba(0, 0, 0, 0.1)' }}>
41+
<div className="h-full w-full overflow-y-auto">
42+
<hr />
43+
44+
<ol>
45+
<li>
46+
<NavLink
47+
className={({ isActive }) =>
48+
`block border-b p-4 text-xl ${isActive ? "bg-white border-r-4 border-blue-500" : ""}`
49+
}
50+
to="old-testament"
51+
>
52+
📖 Old Testament
53+
</NavLink>
54+
</li>
55+
<li>
56+
<NavLink
57+
className={({ isActive }) =>
58+
`block border-b p-4 text-xl ${isActive ? "bg-white border-r-4 border-blue-500" : ""}`
59+
}
60+
to="new-testament"
61+
>
62+
📖 New Testament
63+
</NavLink>
64+
</li>
65+
</ol>
66+
</div>
67+
68+
{/* Close button for mobile sidebar - now on the right when sidebar is open */}
69+
{isSidebarOpen && (
70+
<button
71+
onClick={() => setIsSidebarOpen(false)}
72+
className="md:hidden absolute top-4 right-4 text-gray-500 hover:text-gray-800 focus:outline-none"
73+
>
74+
<svg className="h-6 w-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
75+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M6 18L18 6M6 6l12 12" />
76+
</svg>
77+
</button>
78+
)}
4479
</div>
4580

46-
<div className="flex-1 p-6">
81+
{/* Overlay for mobile when sidebar is open - now covers left side */}
82+
{isSidebarOpen && (
83+
<div
84+
className="fixed inset-0 bg-black opacity-50 md:hidden z-30"
85+
onClick={() => setIsSidebarOpen(false)}
86+
></div>
87+
)}
88+
89+
{/* Main content area - adjusts for sidebar width on desktop, now on the left */}
90+
<div className="flex-1 p-6" style={{ marginRight: '320px', transition: 'margin-right 300ms ease-in-out' }}>
4791
<Outlet />
4892
</div>
4993
</main>

0 commit comments

Comments
 (0)