Skip to content

Commit 128490e

Browse files
committed
feat: verbs header sticky and list scrollable
1 parent 2173db4 commit 128490e

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

src/components/StatementWizard.tsx

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,72 @@ const StatementWizard: React.FC<{ username: string }> = ({ username }) => {
196196
</div>
197197
);
198198
case 'action':
199+
return (
200+
// Container with a fixed height (adjust as needed) to allow proper scrolling.
201+
<div className='flex flex-col' style={{ height: '60vh' }}>
202+
{/* Sticky header: always visible while scrolling */}
203+
<h2 className='sticky top-0 bg-white z-10 py-2 text-2xl font-semibold text-center'>
204+
{getActionQuestion(selection.subject)}
205+
</h2>
206+
207+
{/*
208+
// Filter buttons (temporarily disabled)
209+
<div className="flex flex-wrap gap-2 mb-4">
210+
{categories.map((category) => (
211+
<Button
212+
key={category}
213+
variant={selectedCategory === category ? 'default' : 'outline'}
214+
size="sm"
215+
onClick={() =>
216+
setSelectedCategory(
217+
selectedCategory === category ? null : category
218+
)
219+
}
220+
className="text-xs"
221+
>
222+
{category}
223+
</Button>
224+
))}
225+
</div>
226+
*/}
227+
228+
{/* Scrollable container for the verb grid */}
229+
<div className='overflow-y-auto'>
230+
<div className='grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 gap-2 p-2'>
231+
{verbData
232+
.slice()
233+
.sort((a, b) => a.name.localeCompare(b.name)) // Sorted alphabetically
234+
.map((verb, index) => (
235+
<Button
236+
key={`${verb.name}-${index}`}
237+
variant={
238+
selection.verb === verb.name ? 'default' : 'outline'
239+
}
240+
className='h-auto py-2 px-3 text-left flex items-center justify-center transition-all text-sm'
241+
style={{
242+
backgroundColor:
243+
selection.verb === verb.name
244+
? verb.color
245+
: 'transparent',
246+
color:
247+
selection.verb === verb.name
248+
? getContrastColor(verb.color)
249+
: 'inherit',
250+
borderColor: verb.color,
251+
}}
252+
onClick={() => {
253+
setSelection((prev) => ({ ...prev, verb: verb.name }));
254+
setStep('what');
255+
}}
256+
>
257+
<span className='font-medium'>{verb.name}</span>
258+
</Button>
259+
))}
260+
</div>
261+
</div>
262+
</div>
263+
);
264+
199265
return (
200266
// Main container set to flex column and full available height
201267
<div className='flex flex-col h-full'>

0 commit comments

Comments
 (0)