Files
supabase/examples/slack-clone/nextjs-slack-clone-dotenvx/components/MessageInput.js
Andrew Valleteau 7ce0038156 chore(docs): add dotenvx example (#31213)
* 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]>
2025-01-17 14:33:15 +08:00

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