Skip to content

Commit

Permalink
Merge branch 'main' into shadcn/icons
Browse files Browse the repository at this point in the history
# Conflicts:
#	apps/www/public/r/styles/new-york/accordion.json
#	apps/www/public/r/styles/new-york/calendar.json
#	apps/www/registry/new-york/example/cards/activity-goal.tsx
#	apps/www/registry/new-york/example/cards/chat.tsx
#	apps/www/registry/new-york/example/cards/data-table.tsx
#	apps/www/registry/new-york/example/cards/team-members.tsx
  • Loading branch information
shadcn committed Nov 4, 2024
2 parents 976ab4b + 2c043e7 commit fae5035
Show file tree
Hide file tree
Showing 50 changed files with 478 additions and 135 deletions.
4 changes: 2 additions & 2 deletions apps/www/app/(app)/docs/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default async function DocPage({ params }: DocPageProps) {

return (
<main className="relative py-6 lg:gap-10 lg:py-8 xl:grid xl:grid-cols-[1fr_300px]">
<div className="mx-auto w-full min-w-0">
<div className="mx-auto w-full min-w-0 max-w-3xl">
<div className="mb-4 flex items-center space-x-1 text-sm leading-none text-muted-foreground">
<div className="truncate">Docs</div>
<ChevronRightIcon className="h-3.5 w-3.5" />
Expand Down Expand Up @@ -137,7 +137,7 @@ export default async function DocPage({ params }: DocPageProps) {
<DocsPager doc={doc} />
</div>
<div className="hidden text-sm xl:block">
<div className="sticky top-16 -mt-10 h-[calc(100vh-3.5rem)] pt-4">
<div className="sticky top-20 -mt-6 h-[calc(100vh-3.5rem)] pt-4">
<ScrollArea className="h-full pb-10">
{doc.toc && <DashboardTableOfContents toc={toc} />}
<OpenInV0Cta className="mt-6 max-w-[80%]" />
Expand Down
2 changes: 1 addition & 1 deletion apps/www/app/(app)/docs/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface DocsLayoutProps {

export default function DocsLayout({ children }: DocsLayoutProps) {
return (
<div className="border-b">
<div className="border-b border-border/40 dark:border-border">
<div className="container flex-1 items-start md:grid md:grid-cols-[220px_minmax(0,1fr)] md:gap-6 lg:grid-cols-[240px_minmax(0,1fr)] lg:gap-10">
<aside className="fixed top-14 z-30 -ml-2 hidden h-[calc(100vh-3.5rem)] w-full shrink-0 md:sticky md:block">
<ScrollArea className="h-full py-6 pr-6 lg:py-8">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function DemoShareDocument() {
</div>
<Separator className="my-4" />
<div className="space-y-4">
<h4 className="text-sm font-medium">People with access</h4>
<div className="text-sm font-medium">People with access</div>
<div className="grid gap-6">
<div className="flex items-center justify-between space-x-4">
<div className="flex items-center space-x-4">
Expand Down
4 changes: 2 additions & 2 deletions apps/www/app/(app)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ interface AppLayoutProps {

export default function AppLayout({ children }: AppLayoutProps) {
return (
<>
<div className="mx-auto w-full border-border/40 dark:border-border min-[1800px]:max-w-[1536px] min-[1800px]:border-x">
<SiteHeader />
<main className="flex-1">{children}</main>
<SiteFooter />
</>
</div>
)
}
26 changes: 12 additions & 14 deletions apps/www/app/(app)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
PageHeaderDescription,
PageHeaderHeading,
} from "@/components/page-header"
import CardsNewYork from "@/registry/new-york/example/cards"
import { Button } from "@/registry/new-york/ui/button"
import MailPage from "@/app/(app)/examples/mail/page"

export default function IndexPage() {
return (
Expand All @@ -21,7 +21,7 @@ export default function IndexPage() {
<PageHeaderHeading>Build your component library</PageHeaderHeading>
<PageHeaderDescription>
Beautifully designed components that you can copy and paste into your
apps.
apps. Made with Tailwind CSS. Open source.
</PageHeaderDescription>
<PageActions>
<Button asChild size="sm">
Expand All @@ -41,24 +41,22 @@ export default function IndexPage() {
<ExamplesNav className="[&>a:first-child]:text-primary" />
<section className="overflow-hidden rounded-lg border bg-background shadow-md md:hidden md:shadow-xl">
<Image
src="/examples/mail-dark.png"
src="/examples/cards-light.png"
width={1280}
height={727}
alt="Mail"
className="hidden dark:block"
height={1214}
alt="Cards"
className="block dark:hidden"
/>
<Image
src="/examples/mail-light.png"
src="/examples/cards-dark.png"
width={1280}
height={727}
alt="Mail"
className="block dark:hidden"
height={1214}
alt="Cards"
className="hidden dark:block"
/>
</section>
<section className="hidden md:block">
<div className="overflow-hidden rounded-lg border bg-background shadow">
<MailPage />
</div>
<section className="hidden md:block [&>div]:p-0">
<CardsNewYork />
</section>
</div>
)
Expand Down
17 changes: 9 additions & 8 deletions apps/www/components/callout.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { cn } from "@/lib/utils"
import {
Alert,
AlertDescription,
AlertTitle,
} from "@/registry/new-york/ui/alert"

interface CalloutProps {
icon?: string
title?: string
children?: React.ReactNode
}

export function Callout({ title, children, icon, ...props }: CalloutProps) {
export function Callout({
title,
children,
icon,
className,
...props
}: React.ComponentProps<typeof Alert> & { icon?: string }) {
return (
<Alert {...props}>
<Alert className={cn("bg-muted/50", className)} {...props}>
{icon && <span className="mr-4 text-2xl">{icon}</span>}
{title && <AlertTitle>{title}</AlertTitle>}
<AlertDescription>{children}</AlertDescription>
Expand Down
10 changes: 5 additions & 5 deletions apps/www/components/examples-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import { cn } from "@/lib/utils"
import { ScrollArea, ScrollBar } from "@/registry/new-york/ui/scroll-area"

const examples = [
{
name: "Examples",
href: "/examples/cards",
code: "https://github.com/shadcn/ui/tree/main/apps/www/app/(app)/examples/mail",
},
{
name: "Mail",
href: "/examples/mail",
Expand All @@ -18,11 +23,6 @@ const examples = [
href: "/examples/dashboard",
code: "https://github.com/shadcn/ui/tree/main/apps/www/app/(app)/examples/dashboard",
},
{
name: "Cards",
href: "/examples/cards",
code: "https://github.com/shadcn/ui/tree/main/apps/www/app/(app)/examples/cards",
},
{
name: "Tasks",
href: "/examples/tasks",
Expand Down
13 changes: 8 additions & 5 deletions apps/www/components/mdx-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,23 +139,26 @@ const components = {
<hr className="my-4 md:my-8" {...props} />
),
table: ({ className, ...props }: React.HTMLAttributes<HTMLTableElement>) => (
<div className="my-6 w-full overflow-y-auto rounded-lg">
<div className="my-6 w-full overflow-y-auto">
<table
className={cn(
"relative w-full overflow-hidden text-sm after:absolute after:inset-0 after:rounded-lg after:ring-1 after:ring-border",
"relative w-full overflow-hidden border-none text-sm",
className
)}
{...props}
/>
</div>
),
tr: ({ className, ...props }: React.HTMLAttributes<HTMLTableRowElement>) => (
<tr className={cn("m-0 border-t", className)} {...props} />
<tr
className={cn("last:border-b-none m-0 border-b", className)}
{...props}
/>
),
th: ({ className, ...props }: React.HTMLAttributes<HTMLTableCellElement>) => (
<th
className={cn(
"border px-4 py-2 text-left font-bold [&[align=center]]:text-center [&[align=right]]:text-right",
"px-4 py-2 text-left font-bold [&[align=center]]:text-center [&[align=right]]:text-right",
className
)}
{...props}
Expand All @@ -164,7 +167,7 @@ const components = {
td: ({ className, ...props }: React.HTMLAttributes<HTMLTableCellElement>) => (
<td
className={cn(
"border px-4 py-2 text-left [&[align=center]]:text-center [&[align=right]]:text-right",
"px-4 py-2 text-left [&[align=center]]:text-center [&[align=right]]:text-right",
className
)}
{...props}
Expand Down
33 changes: 9 additions & 24 deletions apps/www/components/mobile-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import * as React from "react"
import Link, { LinkProps } from "next/link"
import { useRouter } from "next/navigation"
import { ViewVerticalIcon } from "@radix-ui/react-icons"
import { MenuIcon } from "lucide-react"

import { docsConfig } from "@/config/docs"
import { siteConfig } from "@/config/site"
Expand All @@ -21,36 +21,21 @@ export function MobileNav() {
<SheetTrigger asChild>
<Button
variant="ghost"
className="mr-2 px-0 text-base hover:bg-transparent focus-visible:bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 md:hidden"
className="-ml-2 mr-2 h-8 w-8 px-0 text-base hover:bg-transparent focus-visible:bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 md:hidden"
>
<svg
strokeWidth="1.5"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className="h-5 w-5"
fill="none"
viewBox="0 0 24 24"
strokeWidth="1.5"
stroke="currentColor"
className="size-6"
>
<path
d="M3 5H11"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
></path>
<path
d="M3 12H16"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
></path>
<path
d="M3 19H21"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
></path>
d="M3.75 9h16.5m-16.5 6.75h16.5"
/>
</svg>
<span className="sr-only">Toggle Menu</span>
</Button>
Expand Down
2 changes: 1 addition & 1 deletion apps/www/components/mode-toggle.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client"

import * as React from "react"
import { MoonIcon, SunIcon } from "@radix-ui/react-icons"
import { MoonIcon, SunIcon } from "lucide-react"
import { useTheme } from "next-themes"

import { Button } from "@/registry/new-york/ui/button"
Expand Down
29 changes: 13 additions & 16 deletions apps/www/components/pager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { Doc } from "contentlayer/generated"
import { NavItem, NavItemWithChildren } from "types/nav"

import { docsConfig } from "@/config/docs"
import { cn } from "@/lib/utils"
import { buttonVariants } from "@/registry/new-york/ui/button"
import { Button } from "@/registry/new-york/ui/button"

interface DocsPagerProps {
doc: Doc
Expand All @@ -21,22 +20,20 @@ export function DocsPager({ doc }: DocsPagerProps) {
return (
<div className="flex flex-row items-center justify-between">
{pager?.prev?.href && (
<Link
href={pager.prev.href}
className={buttonVariants({ variant: "outline" })}
>
<ChevronLeftIcon className="mr-2 h-4 w-4" />
{pager.prev.title}
</Link>
<Button variant="ghost" asChild>
<Link href={pager.prev.href}>
<ChevronLeftIcon />
{pager.prev.title}
</Link>
</Button>
)}
{pager?.next?.href && (
<Link
href={pager.next.href}
className={cn(buttonVariants({ variant: "outline" }), "ml-auto")}
>
{pager.next.title}
<ChevronRightIcon className="ml-2 h-4 w-4" />
</Link>
<Button variant="ghost" className="ml-auto" asChild>
<Link href={pager.next.href}>
{pager.next.title}
<ChevronRightIcon />
</Link>
</Button>
)}
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion apps/www/components/site-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { buttonVariants } from "@/registry/new-york/ui/button"

export function SiteHeader() {
return (
<header className="sticky top-0 z-50 w-full border-border/40 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
<header className="sticky top-0 z-50 w-full border-b border-border/40 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 dark:border-border">
<div className="container flex h-14 max-w-screen-2xl items-center">
<MainNav />
<MobileNav />
Expand Down
5 changes: 5 additions & 0 deletions apps/www/config/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ export const docsConfig: DocsConfig = {
href: "/docs/cli",
items: [],
},
{
title: "Next.js 15 + React 19",
href: "/docs/react-19",
items: [],
},
{
title: "Typography",
href: "/docs/components/typography",
Expand Down
1 change: 1 addition & 0 deletions apps/www/content/docs/cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ Options:
-y, --yes skip confirmation prompt. (default: false)
-o, --overwrite overwrite existing files. (default: false)
-c, --cwd <cwd> the working directory. defaults to the current directory.
-a, --all add all available components. (default: false)
-p, --path <path> the path to add the component to.
-h, --help display help for command
```
Expand Down
11 changes: 11 additions & 0 deletions apps/www/content/docs/components/calendar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,14 @@ You can use the `<Calendar>` component to build a date picker. See the [Date Pic
### Form

<ComponentPreview name="calendar-form" />

## Changelog

### 11-03-2024 day_outside color

- Changed the color of the `day_outside` class to the following to improve contrast:

```tsx showLineNumbers title="calendar.tsx"
"day_outside:
"day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",
```
32 changes: 32 additions & 0 deletions apps/www/content/docs/components/card.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,35 @@ import {
name="card-demo"
description="A card showing notifications settings."
/>

## Changelog

### 11-03-2024 a11y for title and description

- Changed the `CardTitle` and `CardDescription` components to use `div` instead of `h3` and `p` to improve accessibility.

```tsx showLineNumbers title="card.tsx"
const CardTitle = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("font-semibold leading-none tracking-tight", className)}
{...props}
/>
))
CardTitle.displayName = "CardTitle"

const CardDescription = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
))
CardDescription.displayName = "CardDescription"
```
Loading

0 comments on commit fae5035

Please sign in to comment.