From dfc3e184cbc7d21753a0acd747eec5a1cb4a8313 Mon Sep 17 00:00:00 2001 From: fran-ink <171171801+fran-ink@users.noreply.github.com> Date: Fri, 7 Feb 2025 08:57:19 -0500 Subject: [PATCH] feat: make the side bar sticky by default --- src/layout/InkLayout/InkLayout.stories.tsx | 21 +++++++++++++++++++++ src/layout/InkLayout/InkLayout.tsx | 17 +++++++++++++---- src/layout/InkParts/InkPageLayout.tsx | 2 +- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/layout/InkLayout/InkLayout.stories.tsx b/src/layout/InkLayout/InkLayout.stories.tsx index 701ec51..b5efb38 100644 --- a/src/layout/InkLayout/InkLayout.stories.tsx +++ b/src/layout/InkLayout/InkLayout.stories.tsx @@ -78,3 +78,24 @@ export const SideNavWithCustomButtons: Story = { ), }, }; + +/** + * The side nav can be a custom component for routing, for instance, if you want to use NextJS' own {``} component. + */ +export const StickySideNav: Story = { + args: { + children: ( + + +
+
+ If the main content is bigger than the screen, the side nav will + be sticky. +
+
Bottom
+
+
+
+ ), + }, +}; diff --git a/src/layout/InkLayout/InkLayout.tsx b/src/layout/InkLayout/InkLayout.tsx index 31a03a2..4d08933 100644 --- a/src/layout/InkLayout/InkLayout.tsx +++ b/src/layout/InkLayout/InkLayout.tsx @@ -34,7 +34,7 @@ export const InkLayout: React.FC = ({ <>
@@ -73,21 +73,30 @@ export const InkLayout: React.FC = ({
{sideNavigation && (
{sideNavigation}
)} - {children} +
+ {children} +
{isMobileNavOpen && ( diff --git a/src/layout/InkParts/InkPageLayout.tsx b/src/layout/InkParts/InkPageLayout.tsx index 3d485e7..8ed4877 100644 --- a/src/layout/InkParts/InkPageLayout.tsx +++ b/src/layout/InkParts/InkPageLayout.tsx @@ -12,7 +12,7 @@ export const InkPageLayout: React.FC = ({ return (