Switch to regular text area for question b/c causing jump, and no new expansion necessary

This commit is contained in:
jahooma 2022-01-27 17:52:24 -06:00
parent 23ea1d72b7
commit 99bb8fdeea

View File

@ -1,5 +1,4 @@
import { Avatar } from './avatar' import { Avatar } from './avatar'
import Textarea from 'react-expanding-textarea'
import { useRef, useState } from 'react' import { useRef, useState } from 'react'
import { Spacer } from './layout/spacer' import { Spacer } from './layout/spacer'
import { NewContract } from '../pages/create' import { NewContract } from '../pages/create'
@ -78,7 +77,7 @@ export default function FeedCreate(props: {
) )
const placeholder = props.placeholder ?? `e.g. ${placeholders[randIndex]}` const placeholder = props.placeholder ?? `e.g. ${placeholders[randIndex]}`
const inputRef = useRef<HTMLInputElement | null>() const inputRef = useRef<HTMLTextAreaElement | null>()
return ( return (
<div <div
@ -93,15 +92,15 @@ export default function FeedCreate(props: {
<div> <div>
<p className="my-0.5 text-sm">Ask a question... </p> <p className="my-0.5 text-sm">Ask a question... </p>
</div> </div>
<Textarea <textarea
ref={inputRef as any}
className="text-lg sm:text-xl text-indigo-700 w-full border-transparent focus:border-transparent bg-transparent p-0 appearance-none resize-none focus:ring-transparent placeholder:text-gray-400" className="text-lg sm:text-xl text-indigo-700 w-full border-transparent focus:border-transparent bg-transparent p-0 appearance-none resize-none focus:ring-transparent placeholder:text-gray-400"
placeholder={placeholder} placeholder={placeholder}
value={question} value={question}
onClick={(e) => e.stopPropagation()} onClick={(e) => e.stopPropagation()}
onChange={(e) => setQuestion(e.target.value || '')} onChange={(e) => setQuestion(e.target.value.replace('\n', ''))}
ref={inputRef}
/> />
<Spacer h={2} /> <Spacer h={3} />
</div> </div>
</div> </div>