-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Requirement compound component
- Loading branch information
1 parent
f3b52f1
commit 7eff16f
Showing
2 changed files
with
97 additions
and
0 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,48 @@ | ||
import { cn } from "@/lib/cssUtils"; | ||
import type { PropsWithChildren } from "react"; | ||
|
||
export const Requirement = ({ | ||
className, | ||
children, | ||
}: PropsWithChildren<{ className?: string }>) => ( | ||
<div className={cn("flex w-full items-center gap-4 py-2", className)}> | ||
{children} | ||
</div> | ||
); | ||
|
||
export const RequirementImage = ({ | ||
className, | ||
children, | ||
}: PropsWithChildren<{ className?: string }>) => ( | ||
<div | ||
className={cn( | ||
"flex size-11 shrink-0 items-center justify-center overflow-hidden rounded-full bg-blackAlpha dark:bg-blackAlpha-hard", | ||
className, | ||
)} | ||
> | ||
{children} | ||
</div> | ||
); | ||
|
||
export const RequirementContent = ({ | ||
className, | ||
children, | ||
}: PropsWithChildren<{ className?: string }>) => ( | ||
<div className={cn("flex flex-grow flex-col items-start", className)}> | ||
{children} | ||
</div> | ||
); | ||
|
||
export const RequirementFooter = ({ | ||
className, | ||
children, | ||
}: PropsWithChildren<{ className?: string }>) => ( | ||
<div | ||
className={cn( | ||
"flex flex-wrap items-center gap-1.5 has-[>*]:mt-1", | ||
className, | ||
)} | ||
> | ||
{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,49 @@ | ||
import { ChainIndicator } from "@/components/requirements/ChainIndicator"; | ||
import { DataBlockWithCopy } from "@/components/requirements/DataBlockWithCopy"; | ||
import { | ||
Requirement, | ||
RequirementContent, | ||
RequirementFooter, | ||
RequirementImage, | ||
} from "@/components/requirements/Requirement"; | ||
import { Card } from "@/components/ui/Card"; | ||
import { TooltipProvider } from "@/components/ui/Tooltip"; | ||
import { QuestionMark } from "@phosphor-icons/react/dist/ssr"; | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
const RequirementExample = () => ( | ||
<Card className="max-w-sm px-6 py-4"> | ||
<Requirement> | ||
<RequirementImage> | ||
<QuestionMark weight="bold" className="size-6" /> | ||
</RequirementImage> | ||
<RequirementContent> | ||
<p> | ||
<span>{"Copy "}</span> | ||
<DataBlockWithCopy text="this text" /> | ||
<span>{" to your clipboard"}</span> | ||
</p> | ||
|
||
<RequirementFooter className="text-secondary text-sm"> | ||
<ChainIndicator chain={1} /> | ||
</RequirementFooter> | ||
</RequirementContent> | ||
</Requirement> | ||
</Card> | ||
); | ||
|
||
const meta: Meta<typeof RequirementExample> = { | ||
title: "Requirement building blocks/Requirement", | ||
component: RequirementExample, | ||
decorators: (Story) => ( | ||
<TooltipProvider> | ||
<Story /> | ||
</TooltipProvider> | ||
), | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof RequirementExample>; | ||
|
||
export const Default: Story = {}; |