Skip to content

Commit b280729

Browse files
authored
Merge branch 'main' into fix/calendar-full-width-new
2 parents d3ac41a + 5a67028 commit b280729

File tree

965 files changed

+43984
-1574
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

965 files changed

+43984
-1574
lines changed

apps/v4/app/(app)/create/components/customizer.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { FontPicker } from "@/app/(app)/create/components/font-picker"
2222
import { IconLibraryPicker } from "@/app/(app)/create/components/icon-library-picker"
2323
import { MainMenu } from "@/app/(app)/create/components/main-menu"
2424
import { MenuColorPicker } from "@/app/(app)/create/components/menu-picker"
25+
import { ProjectForm } from "@/app/(app)/create/components/project-form"
2526
import { RadiusPicker } from "@/app/(app)/create/components/radius-picker"
2627
import { RandomButton } from "@/app/(app)/create/components/random-button"
2728
import { ResetDialog } from "@/app/(app)/create/components/reset-button"
@@ -56,7 +57,6 @@ export function Customizer({
5657
</CardHeader>
5758
<CardContent className="no-scrollbar min-h-0 flex-1 overflow-x-auto overflow-y-hidden md:overflow-y-auto">
5859
<FieldGroup className="flex-row gap-2.5 py-px **:data-[slot=field-separator]:-mx-4 **:data-[slot=field-separator]:w-auto md:flex-col md:gap-3.25">
59-
{isMobile && <BasePicker isMobile={isMobile} anchorRef={anchorRef} />}
6060
<StylePicker
6161
styles={STYLES}
6262
isMobile={isMobile}
@@ -91,14 +91,18 @@ export function Customizer({
9191
<FieldSeparator className="hidden md:block" />
9292
<MenuColorPicker isMobile={isMobile} anchorRef={anchorRef} />
9393
<MenuAccentPicker isMobile={isMobile} anchorRef={anchorRef} />
94+
{isMobile && <BasePicker isMobile={isMobile} anchorRef={anchorRef} />}
9495
</FieldGroup>
9596
</CardContent>
96-
<CardFooter className="flex min-w-0 gap-2 md:flex-col md:**:[button,a]:w-full">
97+
<CardFooter className="flex min-w-0 gap-2 md:flex-col md:rounded-b-none md:**:[button,a]:w-full">
9798
<CopyPreset className="flex-1 md:flex-none" />
9899
<RandomButton className="flex-1 md:flex-none" />
99100
<ActionMenu itemsByBase={itemsByBase} />
100101
<ResetDialog />
101102
</CardFooter>
103+
<CardFooter className="-mt-3 hidden min-w-0 gap-2 md:flex md:flex-col md:**:[button,a]:w-full">
104+
<ProjectForm />
105+
</CardFooter>
102106
</Card>
103107
)
104108
}

apps/v4/app/(app)/create/components/font-picker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export function FontPicker({
9797
<PickerTrigger>
9898
<div className="flex flex-col justify-start text-left">
9999
<div className="text-xs text-muted-foreground">{label}</div>
100-
<div className="text-sm font-medium text-foreground">
100+
<div className="line-clamp-1 max-w-[80%] truncate text-sm font-medium text-foreground">
101101
{displayFontName}
102102
</div>
103103
</div>

apps/v4/app/(app)/create/components/picker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function PickerTrigger({ className, ...props }: MenuPrimitive.Trigger.Props) {
1919
<MenuPrimitive.Trigger
2020
data-slot="dropdown-menu-trigger"
2121
className={cn(
22-
"relative w-40 shrink-0 touch-manipulation rounded-xl p-3 ring-1 ring-foreground/10 select-none hover:bg-muted focus-visible:ring-foreground/50 focus-visible:outline-none disabled:opacity-50 data-popup-open:bg-muted md:w-full md:rounded-lg md:px-2.5 md:py-2",
22+
"relative w-36 shrink-0 touch-manipulation rounded-xl p-3 ring-1 ring-foreground/10 select-none hover:bg-muted focus-visible:ring-foreground/50 focus-visible:outline-none disabled:opacity-50 data-popup-open:bg-muted md:w-full md:rounded-lg md:px-2.5 md:py-2",
2323
className
2424
)}
2525
{...props}

apps/v4/app/(app)/create/components/preset-picker.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,6 @@ export function PresetPicker({
112112
closeOnClick={isMobile}
113113
>
114114
<div className="flex items-center gap-2">
115-
{style?.icon && (
116-
<div className="flex size-4 shrink-0 items-center justify-center">
117-
{React.cloneElement(style.icon, {
118-
className: "size-4",
119-
})}
120-
</div>
121-
)}
122115
{preset.description}
123116
</div>
124117
</PickerRadioItem>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"use client"
2+
3+
import { Button } from "@/registry/new-york-v4/ui/button"
4+
import { useDesignSystemSearchParams } from "@/app/(app)/create/lib/search-params"
5+
6+
const PREVIEW_ITEMS = [
7+
{ label: "01", value: "preview-02" },
8+
{ label: "02", value: "preview" },
9+
]
10+
11+
export function PreviewSwitcher() {
12+
const [params, setParams] = useDesignSystemSearchParams()
13+
14+
const isPreview =
15+
params.item === "preview" || params.item.startsWith("preview-0")
16+
17+
if (!isPreview) {
18+
return null
19+
}
20+
21+
return (
22+
<div className="dark absolute right-3 bottom-3 z-20 flex items-center gap-1 rounded-xl bg-card/90 p-1 shadow-xl backdrop-blur-xl">
23+
{PREVIEW_ITEMS.map((item) => (
24+
<Button
25+
key={item.value}
26+
variant="ghost"
27+
size="sm"
28+
data-active={params.item === item.value}
29+
className="h-7 min-w-8 cursor-pointer rounded-lg px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground data-[active=true]:bg-accent data-[active=true]:text-accent-foreground"
30+
onClick={() => setParams({ item: item.value })}
31+
>
32+
{item.label}
33+
</Button>
34+
))}
35+
</div>
36+
)
37+
}

apps/v4/app/(app)/create/components/preview.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
UNDO_FORWARD_TYPE,
99
} from "@/app/(app)/create/components/history-buttons"
1010
import { DARK_MODE_FORWARD_TYPE } from "@/app/(app)/create/components/mode-switcher"
11+
import { PreviewSwitcher } from "@/app/(app)/create/components/preview-switcher"
1112
import { RANDOMIZE_FORWARD_TYPE } from "@/app/(app)/create/components/random-button"
1213
import { sendToIframe } from "@/app/(app)/create/hooks/use-iframe-sync"
1314
import { RESET_FORWARD_TYPE } from "@/app/(app)/create/hooks/use-reset"
@@ -147,6 +148,7 @@ export function Preview() {
147148
title="Preview"
148149
/>
149150
</div>
151+
<PreviewSwitcher />
150152
</div>
151153
)
152154
}

apps/v4/app/(app)/create/hooks/use-reset.tsx

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import * as React from "react"
44
import useSWR from "swr"
55

6-
import { DEFAULT_CONFIG } from "@/registry/config"
6+
import { DEFAULT_CONFIG, PRESETS } from "@/registry/config"
77
import { useDesignSystemSearchParams } from "@/app/(app)/create/lib/search-params"
88

99
const RESET_DIALOG_KEY = "create:reset-dialog-open"
@@ -20,22 +20,27 @@ export function useReset() {
2020
})
2121

2222
const reset = React.useCallback(() => {
23+
const preset =
24+
PRESETS.find(
25+
(preset) => preset.base === params.base && preset.style === params.style
26+
) ?? DEFAULT_CONFIG
27+
2328
setParams({
2429
base: params.base,
25-
style: DEFAULT_CONFIG.style,
26-
baseColor: DEFAULT_CONFIG.baseColor,
27-
theme: DEFAULT_CONFIG.theme,
28-
chartColor: DEFAULT_CONFIG.chartColor,
29-
iconLibrary: DEFAULT_CONFIG.iconLibrary,
30-
font: DEFAULT_CONFIG.font,
31-
fontHeading: DEFAULT_CONFIG.fontHeading,
32-
menuAccent: DEFAULT_CONFIG.menuAccent,
33-
menuColor: DEFAULT_CONFIG.menuColor,
34-
radius: DEFAULT_CONFIG.radius,
30+
style: params.style,
31+
baseColor: preset.baseColor,
32+
theme: preset.theme,
33+
chartColor: preset.chartColor,
34+
iconLibrary: preset.iconLibrary,
35+
font: preset.font,
36+
fontHeading: preset.fontHeading,
37+
menuAccent: preset.menuAccent,
38+
menuColor: preset.menuColor,
39+
radius: preset.radius,
3540
template: DEFAULT_CONFIG.template,
3641
item: params.item,
3742
})
38-
}, [setParams, params.base, params.item])
43+
}, [setParams, params.base, params.style, params.item])
3944

4045
const handleShowResetDialogChange = React.useCallback(
4146
(open: boolean) => {

apps/v4/app/(app)/create/lib/search-params.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ import { getPresetCode } from "@/app/(app)/create/lib/preset-code"
4141
import { resolvePresetOverrides } from "@/app/(app)/create/lib/preset-query"
4242

4343
const designSystemSearchParams = {
44-
preset: parseAsString.withDefault("b0"),
44+
preset: parseAsString.withDefault("b2D0wqNxT"),
4545
base: parseAsStringLiteral<BaseName>(BASES.map((b) => b.name)).withDefault(
4646
DEFAULT_CONFIG.base
4747
),
48-
item: parseAsString.withDefault("preview").withOptions({ shallow: true }),
48+
item: parseAsString.withDefault("preview-02").withOptions({ shallow: true }),
4949
iconLibrary: parseAsStringLiteral<IconLibraryName>(
5050
Object.values(iconLibraries).map((i) => i.name)
5151
).withDefault(DEFAULT_CONFIG.iconLibrary),

apps/v4/app/(app)/create/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ export default async function CreatePage() {
4848
>
4949
<Preview />
5050
<Customizer itemsByBase={itemsByBase} />
51-
<PresetHandler />
52-
<WelcomeDialog />
5351
</div>
52+
<PresetHandler />
53+
<WelcomeDialog />
5454
</div>
5555
)
5656
}

apps/v4/app/(app)/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default function AppLayout({ children }: { children: React.ReactNode }) {
55
return (
66
<div
77
data-slot="layout"
8-
className="group/layout relative z-10 flex min-h-svh flex-col bg-background"
8+
className="group/layout relative z-10 flex min-h-svh flex-col bg-background has-data-[slot=designer]:h-svh has-data-[slot=designer]:overflow-hidden"
99
>
1010
<SiteHeader />
1111
<main className="flex min-h-0 flex-1 flex-col">{children}</main>

0 commit comments

Comments
 (0)