-
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.
Add barbones ApplicationFrame component (#665)
* Add barbones ApplicationFrame component * Fix sidebar layout
- Loading branch information
1 parent
dba08a5
commit 49246cf
Showing
6 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
lib/experimental/Navigation/ApplicationFrame/index.stories.tsx
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,24 @@ | ||
import { Placeholder } from "@/lib/storybook-utils" | ||
import type { Meta, StoryObj } from "@storybook/react" | ||
import { ComponentProps } from "react" | ||
import { ApplicationFrame } from "." | ||
import * as SidebarStories from "../Sidebar/index.stories" | ||
import { Sidebar } from "../Sidebar/Sidebar" | ||
|
||
const meta: Meta<typeof ApplicationFrame> = { | ||
component: ApplicationFrame, | ||
tags: ["autodocs"], | ||
parameters: { | ||
layout: "fullscreen", | ||
}, | ||
args: { | ||
sidebar: <Sidebar {...SidebarStories.default.args} />, | ||
children: <Placeholder className="flex-1">Application Content</Placeholder>, | ||
} satisfies ComponentProps<typeof ApplicationFrame>, | ||
} | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof ApplicationFrame> | ||
|
||
export const Default: Story = {} |
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,16 @@ | ||
interface ApplicationFrameProps { | ||
sidebar: React.ReactNode | ||
children: React.ReactNode | ||
} | ||
|
||
export const ApplicationFrame: React.FC<ApplicationFrameProps> = ({ | ||
children, | ||
sidebar, | ||
}) => { | ||
return ( | ||
<div className="flex h-full flex-row gap-4 p-4"> | ||
<div className="w-64">{sidebar}</div> | ||
<div className="flex flex-1">{children}</div> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const Sidebar: React.FC<{ children?: React.ReactNode }> = ({ | ||
children, | ||
}) => { | ||
return <div className="flex flex-col gap-2">{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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import type { Meta, StoryObj } from "@storybook/react" | ||
import { ComponentProps } from "react" | ||
import { Menu } from "./Menu" | ||
import * as SidebarMenuStories from "./Menu/index.stories" | ||
import { SearchBar } from "./Searchbar" | ||
import * as SearchBarStories from "./Searchbar/index.stories" | ||
import { Sidebar } from "./Sidebar" | ||
|
||
const meta: Meta<typeof Sidebar> = { | ||
component: Sidebar, | ||
tags: ["autodocs"], | ||
parameters: { | ||
layout: "centered", | ||
}, | ||
decorators: [ | ||
(Story) => ( | ||
<div className="w-[240px] bg-f1-background-tertiary p-3"> | ||
<Story /> | ||
</div> | ||
), | ||
], | ||
args: { | ||
children: ( | ||
<> | ||
<SearchBar {...SearchBarStories.Default.args} /> | ||
<Menu {...SidebarMenuStories.Default.args} /> | ||
</> | ||
), | ||
} satisfies ComponentProps<typeof Sidebar>, | ||
} | ||
|
||
export default meta | ||
|
||
type Story = StoryObj | ||
|
||
export const Default: Story = {} |
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,2 +1,3 @@ | ||
export * from "./Menu" | ||
export * from "./Searchbar" | ||
export * from "./Sidebar" |