Skip to content

Commit fcd1896

Browse files
committed
feat(docs): point landing page badge to blocks
1 parent d0369d9 commit fcd1896

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

apps/docs/app/(home)/page.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ export default function HomePage() {
1212
<div className="h-6">
1313
<Badge
1414
variant="outline"
15-
className="bg-card dark:bg-secondary border-border/70 gap-1 pr-2 font-normal shadow-sm">
16-
Download the showcase app <ArrowRightIcon className="size-3" />
15+
asChild
16+
className="bg-card dark:bg-secondary border-border/75 gap-1 rounded-full pr-2 font-normal">
17+
<Link href="/docs/blocks/authentication">
18+
New Authentication Blocks <ArrowRightIcon className="size-3" />
19+
</Link>
1720
</Badge>
1821
</div>
1922
<h1 className="text-primary/90 leading-tighter max-w-3xl text-balance text-4xl font-semibold tracking-tight lg:leading-[1.1] xl:max-w-7xl xl:text-5xl xl:font-medium xl:tracking-tighter">

apps/docs/components/ui/badge.tsx

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
import * as React from 'react';
2-
import { cva, type VariantProps } from 'class-variance-authority';
3-
41
import { cn } from '@docs/lib/utils';
2+
import { Slot } from '@radix-ui/react-slot';
3+
import { cva, type VariantProps } from 'class-variance-authority';
4+
import * as React from 'react';
55

66
const badgeVariants = cva(
7-
'focus:ring-ring inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2',
7+
'focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden whitespace-nowrap rounded-md border px-2 py-0.5 text-xs font-medium transition-[color,box-shadow] focus-visible:ring-[3px] [&>svg]:pointer-events-none [&>svg]:size-3',
88
{
99
variants: {
1010
variant: {
11-
default: 'bg-primary text-primary-foreground hover:bg-primary/80 border-transparent',
11+
default: 'bg-primary text-primary-foreground [a&]:hover:bg-primary/90 border-transparent',
1212
secondary:
13-
'bg-secondary text-secondary-foreground hover:bg-secondary/80 border-transparent',
13+
'bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90 border-transparent',
1414
destructive:
15-
'bg-destructive text-destructive-foreground hover:bg-destructive/80 border-transparent',
16-
outline: 'text-foreground',
15+
'bg-destructive [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 border-transparent text-white',
16+
outline: 'text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground',
1717
},
1818
},
1919
defaultVariants: {
@@ -26,8 +26,16 @@ export interface BadgeProps
2626
extends React.HTMLAttributes<HTMLDivElement>,
2727
VariantProps<typeof badgeVariants> {}
2828

29-
function Badge({ className, variant, ...props }: BadgeProps) {
30-
return <div className={cn(badgeVariants({ variant }), className)} {...props} />;
29+
function Badge({
30+
className,
31+
variant,
32+
asChild = false,
33+
...props
34+
}: React.ComponentProps<'span'> & VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
35+
const Comp = asChild ? Slot : 'span';
36+
return (
37+
<Comp data-slot="badge" className={cn(badgeVariants({ variant }), className)} {...props} />
38+
);
3139
}
3240

3341
export { Badge, badgeVariants };

0 commit comments

Comments
 (0)