-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(www): Bento grid on hero section
- Loading branch information
1 parent
36f4d8c
commit ef24ce8
Showing
6 changed files
with
180 additions
and
5 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,90 @@ | ||
import { Badge } from "@/components/ui/badge"; | ||
import { buttonVariants } from "@/components/ui/button"; | ||
import { cn } from "@/lib/utils"; | ||
import type { ClassValue } from "class-variance-authority/types"; | ||
import Link from "next/link"; | ||
import * as React from "react"; | ||
|
||
const BentoGrid = ({ | ||
className, | ||
...props | ||
}: React.HTMLAttributes<HTMLDivElement>) => { | ||
return ( | ||
<div | ||
className={cn("grid w-full grid-cols-3 gap-4", className)} | ||
{...props} | ||
/> | ||
); | ||
}; | ||
|
||
interface BentoItemProps { | ||
title: string; | ||
description: string; | ||
badge?: React.ReactNode; | ||
wrapperClassName?: ClassValue; | ||
children?: React.ReactNode; | ||
href?: string; | ||
cta?: string; | ||
ctaDisabled?: boolean; | ||
headingAs?: React.ElementType; | ||
} | ||
|
||
const BentoItem = ({ | ||
wrapperClassName, | ||
title, | ||
description, | ||
badge, | ||
children, | ||
href, | ||
cta, | ||
ctaDisabled, | ||
headingAs, | ||
}: BentoItemProps) => { | ||
const HeadingComp = headingAs ?? "h3"; | ||
|
||
return ( | ||
<div | ||
className={cn( | ||
"flex flex-col items-start justify-start overflow-hidden rounded-3xl border border-border bg-background p-3 shadow-lg", | ||
wrapperClassName, | ||
)} | ||
> | ||
<div className="p-4"> | ||
{badge && ( | ||
<Badge | ||
className="mb-6 flex-shrink-0 rounded-lg" | ||
size="sm" | ||
variant="secondary" | ||
> | ||
{badge} | ||
</Badge> | ||
)} | ||
<HeadingComp className="text-xl font-semibold"> | ||
{title} | ||
</HeadingComp> | ||
<p className="mt-3 max-w-xl text-muted-foreground"> | ||
{description} | ||
</p> | ||
{href && ( | ||
<Link | ||
aria-disabled={ctaDisabled} | ||
href={href} | ||
className={cn( | ||
buttonVariants({ | ||
variant: "outline", | ||
className: "mt-5 flex-shrink-0", | ||
}), | ||
ctaDisabled && "pointer-events-none opacity-50", | ||
)} | ||
> | ||
{cta ?? "Learn More"} | ||
</Link> | ||
)} | ||
</div> | ||
|
||
{children && children} | ||
</div> | ||
); | ||
}; | ||
|
||
export { BentoGrid, BentoItem }; |
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