1+ import { HydrationBoundary } from "@/components/hydration-boundary" ;
12import { Shell } from "@/components/shell" ;
23import { Button } from "@/components/ui/button" ;
34import {
@@ -15,6 +16,7 @@ import {
1516 SelectTrigger ,
1617 SelectValue ,
1718} from "@/components/ui/select" ;
19+ import { Skeleton } from "@/components/ui/skeleton" ;
1820import { Textarea } from "@/components/ui/textarea" ;
1921import { tricks } from "@/lib/data" ;
2022import {
@@ -26,85 +28,117 @@ import {
2628 ComboboxItem ,
2729 ComboboxTrigger ,
2830} from "@/registry/default/ui/combobox" ;
31+ import * as Masonry from "@/registry/default/ui/masonry" ;
2932import * as Mention from "@diceui/mention" ;
3033import { ChevronDown } from "lucide-react" ;
34+ import * as React from "react" ;
3135
3236export default function PlaygroundPage ( ) {
37+ const items = React . useMemo (
38+ ( ) =>
39+ Array . from ( { length : 10 } , ( _ , i ) => ( {
40+ id : i . toString ( ) ,
41+ content : `Item ${ i + 1 } ` ,
42+ height : Math . floor ( Math . random ( ) * 100 ) + 100 ,
43+ } ) ) ,
44+ [ ] ,
45+ ) ;
46+
3347 return (
3448 < Shell >
35- < Textarea
36- placeholder = "Type here..."
37- className = "min-h-[80px] max-w-[40rem]"
38- />
39- < Mention . Root className = "flex max-w-[40rem] flex-col gap-2 [&_[data-tag]]:rounded [&_[data-tag]]:bg-blue-200 [&_[data-tag]]:py-px [&_[data-tag]]:text-blue-950 dark:[&_[data-tag]]:bg-blue-800 dark:[&_[data-tag]]:text-blue-50" >
40- < Mention . Label > Tricks</ Mention . Label >
41- < Mention . Input
42- placeholder = "Enter @ to mention a trick..."
43- className = "flex min-h-[80px] w-full rounded-md border border-zinc-200 bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-zinc-500 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-zinc-600 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:border-zinc-800 focus-visible:dark:ring-zinc-300"
44- asChild
45- >
46- < textarea />
47- </ Mention . Input >
48- < Mention . Portal >
49- < Mention . Content className = "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 min-w-40 rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=closed]:animate-out data-[state=open]:animate-in" >
50- { tricks . map ( ( trick ) => (
51- < Mention . Item
52- key = { trick . value }
53- label = { trick . label }
54- value = { trick . value }
55- className = "relative flex w-full cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:opacity-50"
56- >
57- { trick . label }
58- </ Mention . Item >
59- ) ) }
60- </ Mention . Content >
61- </ Mention . Portal >
62- </ Mention . Root >
63- < Combobox className = "w-[15rem]" >
64- < ComboboxAnchor >
65- < ComboboxInput placeholder = "Search tricks..." />
66- < ComboboxTrigger >
67- < ChevronDown className = "h-4 w-4" />
68- </ ComboboxTrigger >
69- </ ComboboxAnchor >
70- < ComboboxContent >
71- < ComboboxEmpty > No tricks found</ ComboboxEmpty >
72- { tricks . map ( ( trick ) => (
73- < ComboboxItem key = { trick . value } value = { trick . value } >
74- { trick . label }
75- </ ComboboxItem >
76- ) ) }
77- </ ComboboxContent >
78- </ Combobox >
79- < DropdownMenu >
80- < DropdownMenuTrigger asChild >
81- < Button variant = "outline" size = "sm" className = "w-fit" >
82- Open
83- </ Button >
84- </ DropdownMenuTrigger >
85- < DropdownMenuContent align = "start" >
86- < DropdownMenuItem > Apple</ DropdownMenuItem >
87- < DropdownMenuItem > Banana</ DropdownMenuItem >
88- < DropdownMenuItem > Blueberry</ DropdownMenuItem >
89- < DropdownMenuItem > Grapes</ DropdownMenuItem >
90- < DropdownMenuItem > Pineapple</ DropdownMenuItem >
91- </ DropdownMenuContent >
92- </ DropdownMenu >
93- < Select >
94- < SelectTrigger className = "w-[11.25rem]" >
95- < SelectValue placeholder = "Select a trick" />
96- </ SelectTrigger >
97- < SelectContent >
98- < SelectGroup >
99- < SelectLabel > Tricks</ SelectLabel >
49+ < Masonry . Root
50+ columnCount = { { initial : 1 , md : 2 , lg : 4 } }
51+ defaultColumnCount = { 4 }
52+ gap = { 16 }
53+ >
54+ { items . map ( ( item ) => (
55+ < Masonry . Item
56+ key = { item . id }
57+ fallback = { < Skeleton className = "w-full" style = { { height : 160 } } /> }
58+ className = "rounded-lg border bg-card p-4 text-card-foreground shadow"
59+ style = { {
60+ height : item . height ,
61+ } }
62+ >
63+ { item . content }
64+ </ Masonry . Item >
65+ ) ) }
66+ </ Masonry . Root >
67+ < HydrationBoundary fallback = { < Skeleton className = "h-svh w-full" /> } >
68+ < Textarea
69+ placeholder = "Type here..."
70+ className = "min-h-[80px] max-w-[40rem]"
71+ />
72+ < Mention . Root className = "flex max-w-[40rem] flex-col gap-2 [&_[data-tag]]:rounded [&_[data-tag]]:bg-blue-200 [&_[data-tag]]:py-px [&_[data-tag]]:text-blue-950 dark:[&_[data-tag]]:bg-blue-800 dark:[&_[data-tag]]:text-blue-50" >
73+ < Mention . Label > Tricks</ Mention . Label >
74+ < Mention . Input
75+ placeholder = "Enter @ to mention a trick..."
76+ className = "flex min-h-[80px] w-full rounded-md border border-zinc-200 bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-zinc-500 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-zinc-600 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:border-zinc-800 focus-visible:dark:ring-zinc-300"
77+ asChild
78+ >
79+ < textarea />
80+ </ Mention . Input >
81+ < Mention . Portal >
82+ < Mention . Content className = "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 min-w-40 rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=closed]:animate-out data-[state=open]:animate-in" >
83+ { tricks . map ( ( trick ) => (
84+ < Mention . Item
85+ key = { trick . value }
86+ label = { trick . label }
87+ value = { trick . value }
88+ className = "relative flex w-full cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:opacity-50"
89+ >
90+ { trick . label }
91+ </ Mention . Item >
92+ ) ) }
93+ </ Mention . Content >
94+ </ Mention . Portal >
95+ </ Mention . Root >
96+ < Combobox className = "w-[15rem]" >
97+ < ComboboxAnchor >
98+ < ComboboxInput placeholder = "Search tricks..." />
99+ < ComboboxTrigger >
100+ < ChevronDown className = "h-4 w-4" />
101+ </ ComboboxTrigger >
102+ </ ComboboxAnchor >
103+ < ComboboxContent >
104+ < ComboboxEmpty > No tricks found</ ComboboxEmpty >
100105 { tricks . map ( ( trick ) => (
101- < SelectItem key = { trick . value } value = { trick . value } >
106+ < ComboboxItem key = { trick . value } value = { trick . value } >
102107 { trick . label }
103- </ SelectItem >
108+ </ ComboboxItem >
104109 ) ) }
105- </ SelectGroup >
106- </ SelectContent >
107- </ Select >
110+ </ ComboboxContent >
111+ </ Combobox >
112+ < DropdownMenu >
113+ < DropdownMenuTrigger asChild >
114+ < Button variant = "outline" size = "sm" className = "w-fit" >
115+ Open
116+ </ Button >
117+ </ DropdownMenuTrigger >
118+ < DropdownMenuContent align = "start" >
119+ < DropdownMenuItem > Apple</ DropdownMenuItem >
120+ < DropdownMenuItem > Banana</ DropdownMenuItem >
121+ < DropdownMenuItem > Blueberry</ DropdownMenuItem >
122+ < DropdownMenuItem > Grapes</ DropdownMenuItem >
123+ < DropdownMenuItem > Pineapple</ DropdownMenuItem >
124+ </ DropdownMenuContent >
125+ </ DropdownMenu >
126+ < Select >
127+ < SelectTrigger className = "w-[11.25rem]" >
128+ < SelectValue placeholder = "Select a trick" />
129+ </ SelectTrigger >
130+ < SelectContent >
131+ < SelectGroup >
132+ < SelectLabel > Tricks</ SelectLabel >
133+ { tricks . map ( ( trick ) => (
134+ < SelectItem key = { trick . value } value = { trick . value } >
135+ { trick . label }
136+ </ SelectItem >
137+ ) ) }
138+ </ SelectGroup >
139+ </ SelectContent >
140+ </ Select >
141+ </ HydrationBoundary >
108142 </ Shell >
109143 ) ;
110144}
0 commit comments