mirror of
https://github.com/supabase/supabase.git
synced 2026-10-17 23:29:08 +03:00
* Switch all top-level imports for ui-patterns components to use specific components when importing. * Remove the @ui-patterns shorthand since it works exactly the same without the @. * More import fixes. * Fix the ui-patterns tests.
31 lines
817 B
TypeScript
31 lines
817 B
TypeScript
import { Box } from 'lucide-react'
|
|
import { useState } from 'react'
|
|
import { AssistantChatForm } from 'ui-patterns/AssistantChat'
|
|
|
|
export default function AssistantChatDemo() {
|
|
const [value, setValueState] = useState('')
|
|
const [loading, setLoading] = useState(false)
|
|
|
|
function handleSubmit(event: React.FormEvent) {
|
|
// set loading for 3 seconds and then reset
|
|
setLoading(true)
|
|
setTimeout(() => {
|
|
setLoading(false)
|
|
}, 1500)
|
|
}
|
|
|
|
return (
|
|
<AssistantChatForm
|
|
icon={<Box strokeWidth={1.5} size={24} className="text-foreground-muted" />}
|
|
value={value}
|
|
loading={loading}
|
|
disabled={loading}
|
|
onValueChange={(e) => setValueState(e.target.value)}
|
|
onSubmit={async (event) => {
|
|
event.preventDefault()
|
|
handleSubmit(event)
|
|
}}
|
|
/>
|
|
)
|
|
}
|