-
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 Header component and update TS and Rollup config
- Loading branch information
1 parent
c7e7674
commit 98b35ba
Showing
17 changed files
with
202 additions
and
110 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 @@ | ||
tsconfig.json |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { cva } from "~/shared/cva" | ||
|
||
export const containerVariants = cva({ | ||
base: "container mx-auto px-8", | ||
base: "container mx-auto w-full px-8", | ||
}) |
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,43 @@ | ||
import type { Meta, StoryObj } from "@storybook/react" | ||
import { IconBellRinging, IconCalendar, IconPlus, IconSearch, IconTable } from "@tabler/icons-react" | ||
|
||
import { Button } from "~/ui/Button" | ||
|
||
import { Header } from "./Header" | ||
|
||
type Story = StoryObj<typeof Header> | ||
|
||
// Meta | ||
export default { | ||
title: "Layout/Header", | ||
component: Header, | ||
parameters: { | ||
layout: "padded", | ||
}, | ||
args: { | ||
...Header.defaultProps, | ||
size: "lg", | ||
avatar: { | ||
children: <IconTable />, | ||
variant: "outline", | ||
theme: "gray", | ||
}, | ||
title: "Insert page title here", | ||
description: "Insert page description here", | ||
children: ( | ||
<div className="flex items-center gap-3"> | ||
<Button theme="gray" variant="ghost" prefix={<IconSearch />} /> | ||
<Button theme="gray" variant="ghost" prefix={<IconBellRinging />} /> | ||
<Button theme="gray" variant="outline" prefix={<IconCalendar />}> | ||
Schedule | ||
</Button> | ||
<Button prefix={<IconPlus />}>Create Request</Button> | ||
</div> | ||
), | ||
}, | ||
} satisfies Meta | ||
|
||
// Stories | ||
export const Default = { | ||
args: {}, | ||
} satisfies 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,27 @@ | ||
import { forwardRef } from "react" | ||
import type { HTMLAttributes } from "react" | ||
|
||
import { cx, type VariantProps } from "~/shared/cva" | ||
import { Blurb, type BlurbProps } from "~/ui/Blurb" | ||
|
||
import { headerBlurbVariants, headerVariants } from "./Header.variants" | ||
|
||
export type HeaderElement = HTMLDivElement | ||
|
||
export type HeaderProps = HTMLAttributes<HeaderElement> & | ||
BlurbProps & | ||
VariantProps<typeof headerVariants> | ||
|
||
export const Header = forwardRef<HeaderElement, HeaderProps>((props, ref) => { | ||
const { className, ...rest } = props | ||
|
||
return ( | ||
<div ref={ref} className={cx(headerVariants({ className }))} {...rest}> | ||
<Blurb className={cx(headerBlurbVariants())} {...rest} /> | ||
</div> | ||
) | ||
}) | ||
|
||
Header.defaultProps = {} | ||
|
||
Header.displayName = "Header" |
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,9 @@ | ||
import { cva } from "~/shared/cva" | ||
|
||
export const headerVariants = cva({ | ||
base: "flex flex-wrap items-center gap-y-2 gap-x-6 lg:gap-x-12", | ||
}) | ||
|
||
export const headerBlurbVariants = cva({ | ||
base: "flex-1", | ||
}) |
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,2 @@ | ||
export { Header } from "./Header" | ||
export type { HeaderProps, HeaderElement } from "./Header" |
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
Oops, something went wrong.