-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Page component * Sidebar adapted * Layouts * typo * Base layouts * Remove unused story
- Loading branch information
1 parent
e97f90c
commit 058dd8d
Showing
10 changed files
with
95 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from "react" | ||
|
||
export interface StandardLayoutProps { | ||
children: React.ReactNode | ||
} | ||
|
||
export function StandardLayout({ children }: StandardLayoutProps) { | ||
return ( | ||
<div className="flex flex-1 flex-col gap-4 overflow-y-auto px-6 py-5"> | ||
{children} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Placeholder } from "@/lib/storybook-utils" | ||
import type { Meta, StoryObj } from "@storybook/react" | ||
import { Page } from "." | ||
|
||
import Header from "../Header/Header" | ||
import * as HeaderStories from "../Header/Header/index.stories" | ||
import { Tabs } from "../Tabs" | ||
import * as TabsStories from "../Tabs/index.stories" | ||
|
||
import { StandardLayout } from "@/experimental/Layouts/StandardLayout" | ||
|
||
const meta: Meta<typeof Page> = { | ||
component: Page, | ||
tags: ["autodocs"], | ||
parameters: { | ||
layout: "fullscreen", | ||
}, | ||
decorators: [ | ||
(Story) => ( | ||
<div className="bg-f1-background-tertiary p-2"> | ||
<Story /> | ||
</div> | ||
), | ||
], | ||
} | ||
|
||
export default meta | ||
type Story = StoryObj | ||
|
||
export const Default: Story = { | ||
args: { | ||
header: ( | ||
<> | ||
<Header | ||
{...HeaderStories.FirstLevel.args} | ||
menu={{ show: false, onClick: () => {} }} | ||
/> | ||
<Tabs {...TabsStories.Primary.args} /> | ||
</> | ||
), | ||
children: ( | ||
<StandardLayout> | ||
{Array(25) | ||
.fill(0) | ||
.map((_, index) => ( | ||
<Placeholder key={index} className="min-h-24" /> | ||
))} | ||
</StandardLayout> | ||
), | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
interface PageProps { | ||
children?: React.ReactNode | ||
header?: React.ReactNode | ||
} | ||
|
||
export function Page({ children, header }: PageProps) { | ||
return ( | ||
<div className="flex w-full flex-col overflow-hidden rounded-xl bg-f1-background shadow"> | ||
{header && <div className="flex flex-col">{header}</div>} | ||
{children} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,37 @@ | ||
import { useNavigation } from "@/lib/linkHandler" | ||
import type { Meta, StoryObj } from "@storybook/react" | ||
import { TabItem, Tabs } from "." | ||
import { Tabs } from "." | ||
|
||
const tabItems: TabItem[] = [ | ||
const tabItems = [ | ||
{ label: "Overview", href: "/", exactMatch: true }, | ||
{ label: "Courses", href: "/courses" }, | ||
{ label: "Categories", href: "/categories" }, | ||
{ label: "Catalog", href: "/catalog" }, | ||
{ label: "Requests", href: "/requests" }, | ||
] | ||
|
||
const meta: Meta<typeof Tabs> = { | ||
const meta = { | ||
component: Tabs, | ||
tags: ["autodocs"], | ||
argTypes: { | ||
secondary: { | ||
control: "boolean", | ||
}, | ||
}, | ||
render: ({ secondary = false }: { secondary?: boolean }) => { | ||
const { isActive } = useNavigation() | ||
const activeTab = tabItems.find((tab) => | ||
isActive(tab.href, { exact: true }) | ||
) | ||
|
||
return ( | ||
<div onClick={(e) => e.preventDefault()}> | ||
<Tabs tabs={tabItems} secondary={secondary} /> | ||
<p className="mt-4 flex h-full min-h-60 items-center justify-center rounded-lg bg-f1-background-secondary/50 p-4 text-f1-foreground-secondary"> | ||
{activeTab?.label} | ||
</p> | ||
</div> | ||
) | ||
}, | ||
} | ||
} satisfies Meta<typeof Tabs> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof Tabs> | ||
type Story = StoryObj<typeof meta> | ||
|
||
export const Primary: Story = { | ||
args: { | ||
tabs: tabItems, | ||
secondary: false, | ||
}, | ||
} | ||
|
||
export const Secondary: Story = { | ||
args: { | ||
tabs: tabItems, | ||
secondary: true, | ||
}, | ||
} |