Rename header components into one TopNav

This commit is contained in:
adilallo
2026-02-06 08:27:44 -07:00
parent e3478e6105
commit 0aaa694fab
19 changed files with 774 additions and 1097 deletions
@@ -1,247 +0,0 @@
import Header from "../../app/components/navigation/Header";
export default {
title: "Components/Navigation/Header/Responsive",
component: Header,
parameters: {
// Chromatic configuration for responsive testing
chromatic: {
viewports: [320, 360, 480, 640, 768, 1024, 1280, 1440, 1920],
// Capture screenshots at each breakpoint
delay: 200, // Increased delay to ensure layout is stable
// Capture both light and dark themes if available
modes: {
light: {},
dark: {
// This will be used if dark mode is implemented
colorScheme: "dark",
},
},
},
// Storybook viewport configuration
viewport: {
viewports: {
xs: {
name: "Extra Small (xs)",
styles: {
width: "360px",
height: "700px",
},
},
sm: {
name: "Small (sm)",
styles: {
width: "640px",
height: "700px",
},
},
md: {
name: "Medium (md)",
styles: {
width: "768px",
height: "700px",
},
},
lg: {
name: "Large (lg)",
styles: {
width: "1024px",
height: "700px",
},
},
xl: {
name: "Extra Large (xl)",
styles: {
width: "1280px",
height: "700px",
},
},
xxl: {
name: "2XL (xxl)",
styles: {
width: "1440px",
height: "700px",
},
},
full: {
name: "Full HD (full)",
styles: {
width: "1920px",
height: "700px",
},
},
},
},
},
argTypes: {
onToggle: { action: "toggled" },
},
};
// Default story - will be captured at all viewports by Chromatic
export const Default = {
args: {
onToggle: () => console.log("Navigation toggled"),
},
parameters: {
docs: {
description: {
story:
"Header component at different breakpoints. Chromatic will capture screenshots at 360px, 640px, 768px, 1024px, and 1280px viewport widths to test responsive behavior.",
},
},
},
};
// Story for each breakpoint to make testing easier
export const ExtraSmall = {
args: {
onToggle: () => console.log("Navigation toggled"),
},
parameters: {
viewport: {
defaultViewport: "xs",
},
docs: {
description: {
story:
"Header at extra small breakpoint (360px). Navigation items are moved to the right section.",
},
},
},
};
export const Small = {
args: {
onToggle: () => console.log("Navigation toggled"),
},
parameters: {
viewport: {
defaultViewport: "sm",
},
docs: {
description: {
story:
"Header at small breakpoint (640px). All navigation items are grouped together in the center.",
},
},
},
};
export const Medium = {
args: {
onToggle: () => console.log("Navigation toggled"),
},
parameters: {
viewport: {
defaultViewport: "md",
},
docs: {
description: {
story:
"Header at medium breakpoint (768px). Navigation items are in the center, login and create rule buttons on the right.",
},
},
},
};
export const Large = {
args: {
onToggle: () => console.log("Navigation toggled"),
},
parameters: {
viewport: {
defaultViewport: "lg",
},
docs: {
description: {
story:
"Header at large breakpoint (1024px). Full navigation layout with larger elements.",
},
},
},
};
export const ExtraLarge = {
args: {
onToggle: () => console.log("Navigation toggled"),
},
parameters: {
viewport: {
defaultViewport: "xl",
},
docs: {
description: {
story:
"Header at extra large breakpoint (1280px). Maximum size layout with largest elements.",
},
},
},
};
// Story for testing with long content
export const WithLongContent = {
args: {
onToggle: () => console.log("Navigation toggled"),
},
render: () => (
<div className="min-h-screen bg-[var(--color-surface-default-primary)]">
<Header onToggle={() => console.log("Navigation toggled")} />
<main className="p-8">
<div className="max-w-4xl mx-auto">
<h1 className="text-2xl font-bold text-white mb-4">
Header with Long Content
</h1>
<p className="text-white mb-4">
This story tests how the header looks with a lot of content below
it. This helps ensure the header maintains its visual integrity in
real-world scenarios.
</p>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
{Array.from({ length: 12 }, (_, i) => (
<div
key={i}
className="bg-[var(--color-surface-default-secondary)] p-4 rounded-lg"
>
<h3 className="text-white font-semibold mb-2">
Content Block {i + 1}
</h3>
<p className="text-[var(--color-content-default-secondary)] text-sm">
This is example content to show how the header integrates with
page content. This block contains enough text to test layout
behavior.
</p>
</div>
))}
</div>
</div>
</main>
</div>
),
parameters: {
docs: {
description: {
story:
"Header with long content below to test visual integration and layout stability.",
},
},
},
};
// Story for testing edge cases
export const EdgeCases = {
args: {
onToggle: () => console.log("Navigation toggled"),
},
parameters: {
viewport: {
defaultViewport: "xs",
},
docs: {
description: {
story:
"Header at the smallest breakpoint to test edge case behavior and ensure no layout issues.",
},
},
},
};
-75
View File
@@ -1,75 +0,0 @@
import Header from "../../app/components/navigation/Header";
export default {
title: "Components/Navigation/Header",
component: Header,
parameters: {
layout: "fullscreen",
docs: {
description: {
component:
"The main navigation header with responsive behavior across different breakpoints. Features sticky positioning and active state highlighting for current page navigation.",
},
},
},
argTypes: {},
tags: ["autodocs"],
};
export const Default = {
args: {},
parameters: {
docs: {
description: {
story:
"Use the Viewport toolbar to change the iframe width and see how the header adapts to different screen sizes. The header shows different layouts for mobile, tablet, and desktop breakpoints.",
},
},
},
};
// Story to show the header in a realistic page context
export const InPageContext = {
args: {},
render: () => (
<div className="min-h-screen bg-[var(--color-surface-default-primary)]">
<Header />
<main className="p-8">
<div className="max-w-4xl mx-auto">
<h1 className="text-2xl font-bold text-white mb-4">
Example Page Content
</h1>
<p className="text-white mb-4">
This demonstrates how the header looks in a realistic page context.
The header maintains its responsive behavior while providing
navigation for the page content.
</p>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
{[1, 2, 3, 4, 5, 6].map((i) => (
<div
key={i}
className="bg-[var(--color-surface-default-secondary)] p-4 rounded-lg"
>
<h3 className="text-white font-semibold mb-2">
Content Block {i}
</h3>
<p className="text-[var(--color-content-default-secondary)] text-sm">
This is example content to show how the header integrates with
page content.
</p>
</div>
))}
</div>
</div>
</main>
</div>
),
parameters: {
docs: {
description: {
story:
"The header integrated into a full page layout to show how it works in context.",
},
},
},
};
-72
View File
@@ -1,72 +0,0 @@
import HomeHeader from "../../app/components/navigation/HomeHeader";
export default {
title: "Components/Navigation/HomeHeader",
component: HomeHeader,
parameters: {
layout: "fullscreen",
docs: {
description: {
component:
"The home page header with transparent background, HeaderTab wrapper, and responsive behavior. Features active state highlighting for current page navigation.",
},
},
},
tags: ["autodocs"],
};
export const Default = {
args: {},
parameters: {
docs: {
description: {
story:
"Use the Viewport toolbar to see how the home header adapts to different screen sizes. The header has a transparent background and uses HeaderTab for the left section.",
},
},
},
};
// Story to show the home header in a realistic home page context
export const InHomePageContext = {
args: {},
render: () => (
<div className="min-h-screen bg-gradient-to-b from-[var(--color-surface-default-primary)] to-[var(--color-surface-default-secondary)]">
<HomeHeader />
<main className="p-8">
<div className="max-w-4xl mx-auto text-center">
<h1 className="text-4xl font-bold text-white mb-4">
Welcome to CommunityRule
</h1>
<p className="text-xl text-[var(--color-content-default-secondary)] mb-8">
This demonstrates how the home header looks in a realistic home page
context. The header maintains its transparent background and
responsive behavior.
</p>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{[1, 2, 3].map((i) => (
<div
key={i}
className="bg-[var(--color-surface-default-secondary)] p-6 rounded-lg border border-[var(--border-color-default-tertiary)]"
>
<h3 className="text-white font-semibold mb-3">Feature {i}</h3>
<p className="text-[var(--color-content-default-secondary)]">
This is example content to show how the home header integrates
with home page content.
</p>
</div>
))}
</div>
</div>
</main>
</div>
),
parameters: {
docs: {
description: {
story:
"The home header integrated into a full home page layout with gradient background to show the transparent header effect.",
},
},
},
};
+206
View File
@@ -0,0 +1,206 @@
import TopNav from "../../app/components/navigation/TopNav";
export default {
title: "Components/Navigation/TopNav",
component: TopNav,
parameters: {
layout: "fullscreen",
docs: {
description: {
component:
"Unified navigation component that supports two variants: folderTop (home page style with yellow HeaderTab) and standard (dark sticky header). Supports all props from Figma design: size, loggedIn, folderTop, profile, and logIn.",
},
},
},
argTypes: {
folderTop: {
control: "boolean",
description: "When true, renders the home page variant with HeaderTab wrapper. When false, renders the standard header variant.",
},
loggedIn: {
control: "boolean",
description: "Whether the user is logged in (affects displayed elements).",
},
profile: {
control: "boolean",
description: "Whether to show the profile avatar.",
},
logIn: {
control: "boolean",
description: "Whether to show the Log in button.",
},
},
tags: ["autodocs"],
};
// Standard variant (folderTop=false)
export const Standard = {
args: {
folderTop: false,
loggedIn: false,
profile: false,
logIn: true,
},
parameters: {
docs: {
description: {
story:
"Standard header variant (folderTop=false) with dark background and sticky positioning. Use the Viewport toolbar to see responsive behavior.",
},
},
},
};
// Home page variant (folderTop=true)
export const HomePage = {
args: {
folderTop: true,
loggedIn: false,
profile: false,
logIn: true,
},
parameters: {
docs: {
description: {
story:
"Home page variant (folderTop=true) with transparent background and yellow HeaderTab wrapper. Use the Viewport toolbar to see responsive behavior.",
},
},
},
};
// Standard variant with logged in user
export const StandardLoggedIn = {
args: {
folderTop: false,
loggedIn: true,
profile: true,
logIn: false,
},
parameters: {
docs: {
description: {
story:
"Standard header variant with logged in user showing profile avatar instead of login button.",
},
},
},
};
// Home page variant with logged in user
export const HomePageLoggedIn = {
args: {
folderTop: true,
loggedIn: true,
profile: true,
logIn: false,
},
parameters: {
docs: {
description: {
story:
"Home page variant with logged in user showing profile avatar instead of login button.",
},
},
},
};
// Standard variant in page context
export const StandardInPageContext = {
args: {
folderTop: false,
loggedIn: false,
profile: false,
logIn: true,
},
render: (args) => (
<div className="min-h-screen bg-[var(--color-surface-default-primary)]">
<TopNav {...args} />
<main className="p-8">
<div className="max-w-4xl mx-auto">
<h1 className="text-2xl font-bold text-white mb-4">
Example Page Content
</h1>
<p className="text-white mb-4">
This demonstrates how the standard header looks in a realistic page
context. The header maintains its responsive behavior while providing
navigation for the page content.
</p>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
{[1, 2, 3, 4, 5, 6].map((i) => (
<div
key={i}
className="bg-[var(--color-surface-default-secondary)] p-4 rounded-lg"
>
<h3 className="text-white font-semibold mb-2">
Content Block {i}
</h3>
<p className="text-[var(--color-content-default-secondary)] text-sm">
This is example content to show how the header integrates with
page content.
</p>
</div>
))}
</div>
</div>
</main>
</div>
),
parameters: {
docs: {
description: {
story:
"The standard header integrated into a full page layout to show how it works in context.",
},
},
},
};
// Home page variant in home page context
export const HomePageInContext = {
args: {
folderTop: true,
loggedIn: false,
profile: false,
logIn: true,
},
render: (args) => (
<div className="min-h-screen bg-gradient-to-b from-[var(--color-surface-default-primary)] to-[var(--color-surface-default-secondary)]">
<TopNav {...args} />
<main className="p-8">
<div className="max-w-4xl mx-auto text-center">
<h1 className="text-4xl font-bold text-white mb-4">
Welcome to CommunityRule
</h1>
<p className="text-xl text-[var(--color-content-default-secondary)] mb-8">
This demonstrates how the home header looks in a realistic home page
context. The header maintains its transparent background and
responsive behavior.
</p>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{[1, 2, 3].map((i) => (
<div
key={i}
className="bg-[var(--color-surface-default-secondary)] p-6 rounded-lg border border-[var(--border-color-default-tertiary)]"
>
<h3 className="text-white font-semibold mb-3">Feature {i}</h3>
<p className="text-[var(--color-content-default-secondary)]">
This is example content to show how the home header integrates
with home page content.
</p>
</div>
))}
</div>
</div>
</main>
</div>
),
parameters: {
docs: {
description: {
story:
"The home header integrated into a full home page layout with gradient background to show the transparent header effect.",
},
},
},
};