@@ -5,16 +5,31 @@ import clsx from "clsx";
5
5
import type * as React from "react" ;
6
6
import { twMerge } from "tailwind-merge" ;
7
7
8
+ const promptsVariants = cva ( "flex" , {
9
+ variants : {
10
+ size : {
11
+ xs : "gap-2" ,
12
+ sm : "gap-3" ,
13
+ default : "gap-4" ,
14
+ md : "gap-4" ,
15
+ lg : "gap-5" ,
16
+ } ,
17
+ } ,
18
+ defaultVariants : {
19
+ size : "default" ,
20
+ } ,
21
+ } ) ;
22
+
8
23
const promptVariants = cva (
9
- "flex flex-col gap-1 justify-center rounded-md border border-gray-300 shadow-sm" ,
24
+ "flex flex-col justify-center bg-white border border-gray-200 rounded-lg hover:border-gray- 300 hover: shadow-sm transition-all duration-150 cursor-pointer " ,
10
25
{
11
26
variants : {
12
27
size : {
13
- default : "px-4 py-2" ,
14
- lg : "px-6 py-4 text-lg " ,
15
- md : "px-4 py-2 text-base " ,
16
- sm : "px-2 py-1 text-sm " ,
17
- xs : "px-1 py-0.5 text-xs " ,
28
+ xs : "px-3 py-2 gap-1 " ,
29
+ sm : "px-4 py-2.5 gap-1.5 " ,
30
+ default : "px-4 py-3 gap-2 " ,
31
+ md : "px-5 py-3.5 gap-2 " ,
32
+ lg : "px-6 py-4 gap-2.5 " ,
18
33
} ,
19
34
} ,
20
35
defaultVariants : {
@@ -23,24 +38,59 @@ const promptVariants = cva(
23
38
} ,
24
39
) ;
25
40
26
- export function Prompts ( { className, ...props } : React . ComponentProps < "div" > ) {
41
+ const promptTitleVariants = cva ( "font-medium text-gray-900" , {
42
+ variants : {
43
+ size : {
44
+ xs : "text-sm" ,
45
+ sm : "text-base" ,
46
+ default : "text-base" ,
47
+ md : "text-lg" ,
48
+ lg : "text-xl" ,
49
+ } ,
50
+ } ,
51
+ defaultVariants : {
52
+ size : "default" ,
53
+ } ,
54
+ } ) ;
55
+
56
+ const promptDescriptionVariants = cva ( "text-gray-600" , {
57
+ variants : {
58
+ size : {
59
+ xs : "text-xs" ,
60
+ sm : "text-sm" ,
61
+ default : "text-sm" ,
62
+ md : "text-base" ,
63
+ lg : "text-base" ,
64
+ } ,
65
+ } ,
66
+ defaultVariants : {
67
+ size : "default" ,
68
+ } ,
69
+ } ) ;
70
+
71
+ export function Prompts ( {
72
+ className,
73
+ size,
74
+ ...props
75
+ } : React . ComponentProps < "div" > & VariantProps < typeof promptsVariants > ) {
27
76
return (
28
77
< div
29
78
data-slot = "prompts"
30
- className = { twMerge ( clsx ( "flex flex-row flex-wrap gap-4" , className ) ) }
79
+ className = { twMerge ( clsx ( promptsVariants ( { size } ) , className ) ) }
31
80
{ ...props }
32
81
/>
33
82
) ;
34
83
}
35
84
36
85
export function Prompt ( {
37
86
className,
38
- size,
87
+ size = "default" ,
39
88
...props
40
89
} : React . ComponentProps < "div" > & VariantProps < typeof promptVariants > ) {
41
90
return (
42
91
< div
43
92
data-slot = "prompt"
93
+ data-size = { size }
44
94
className = { twMerge ( clsx ( promptVariants ( { size, className } ) ) ) }
45
95
{ ...props }
46
96
/>
@@ -49,27 +99,51 @@ export function Prompt({
49
99
50
100
export function PromptTitle ( {
51
101
className,
102
+ size,
52
103
...props
53
- } : React . ComponentProps < "h3" > ) {
104
+ } : React . ComponentProps < "h3" > & VariantProps < typeof promptTitleVariants > ) {
105
+ const computedClassName = size
106
+ ? twMerge ( clsx ( promptTitleVariants ( { size, className } ) ) )
107
+ : twMerge (
108
+ clsx (
109
+ "font-medium text-gray-900" ,
110
+ "[div[data-size='xs']_&]:text-sm" ,
111
+ "[div[data-size='sm']_&]:text-base" ,
112
+ "[div[data-size='default']_&]:text-base" ,
113
+ "[div[data-size='md']_&]:text-lg" ,
114
+ "[div[data-size='lg']_&]:text-xl" ,
115
+ className ,
116
+ ) ,
117
+ ) ;
118
+
54
119
return (
55
- < h3
56
- data-slot = "prompt-title"
57
- className = { twMerge (
58
- clsx ( "inline-flex items-center font-semibold gap-3" , className ) ,
59
- ) }
60
- { ...props }
61
- />
120
+ < h3 data-slot = "prompt-title" className = { computedClassName } { ...props } />
62
121
) ;
63
122
}
64
123
65
124
export function PromptDescription ( {
66
125
className,
126
+ size,
67
127
...props
68
- } : React . ComponentProps < "p" > ) {
128
+ } : React . ComponentProps < "p" > & VariantProps < typeof promptDescriptionVariants > ) {
129
+ const computedClassName = size
130
+ ? twMerge ( clsx ( promptDescriptionVariants ( { size, className } ) ) )
131
+ : twMerge (
132
+ clsx (
133
+ "text-gray-600" ,
134
+ "[div[data-size='xs']_&]:text-xs" ,
135
+ "[div[data-size='sm']_&]:text-sm" ,
136
+ "[div[data-size='default']_&]:text-sm" ,
137
+ "[div[data-size='md']_&]:text-base" ,
138
+ "[div[data-size='lg']_&]:text-base" ,
139
+ className ,
140
+ ) ,
141
+ ) ;
142
+
69
143
return (
70
144
< p
71
145
data-slot = "prompt-description"
72
- className = { twMerge ( clsx ( "text-sm text-gray-500" , className ) ) }
146
+ className = { computedClassName }
73
147
{ ...props }
74
148
/>
75
149
) ;
0 commit comments