mirror of
https://github.com/supabase/supabase.git
synced 2026-09-07 02:20:52 +08:00
* wip * wip * wip * remove seeds * wip * add branching memento * remove triple dots * proofread * chore: mention direct secret usage * chore: update README.md * chore: update docs * fix: .env.local to .env.developemnt * chore: fix typo * chore: fix commands * chore: update README.md * chore: apply PR comments * chore: rename .env.local to .env * chore: simplify dotenvx setup (#32824) * chore: bump cli * chore: disable unused seed --------- Co-authored-by: Han Qiao <[email protected]> Co-authored-by: Qiao Han <[email protected]>
29 lines
701 B
JavaScript
29 lines
701 B
JavaScript
import { useState } from 'react'
|
|
|
|
const MessageInput = ({ onSubmit }) => {
|
|
const [messageText, setMessageText] = useState('')
|
|
|
|
const submitOnEnter = (event) => {
|
|
// Watch for enter key
|
|
if (event.keyCode === 13) {
|
|
onSubmit(messageText)
|
|
setMessageText('')
|
|
}
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<input
|
|
className="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
|
|
type="text"
|
|
placeholder="Send a message"
|
|
value={messageText}
|
|
onChange={(e) => setMessageText(e.target.value)}
|
|
onKeyDown={(e) => submitOnEnter(e)}
|
|
/>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default MessageInput
|