fixing errors

This commit is contained in:
ingawei 2022-10-11 19:29:47 -07:00
parent 2b3378f5df
commit 1410bef852

View File

@ -209,11 +209,15 @@ export function ContractPageContent(
const [answerResponse, setAnswerResponse] = useState<Answer | undefined>( const [answerResponse, setAnswerResponse] = useState<Answer | undefined>(
undefined undefined
) )
const answerRef = useRef<null | HTMLDivElement>(null)
const onAnswerCommentClick = useEvent((answer: Answer) => { const onAnswerCommentClick = useEvent((answer: Answer) => {
setAnswerResponse(answer) setAnswerResponse(answer)
if (answerRef.current) {
answerRef.current.scrollIntoView({ behavior: 'smooth' }) answerRef.current.scrollIntoView({ behavior: 'smooth' })
} else {
console.error('no ref to scroll to')
}
}) })
const answerRef = useRef(null)
const onCancelAnswerResponse = useEvent(() => setAnswerResponse(undefined)) const onCancelAnswerResponse = useEvent(() => setAnswerResponse(undefined))
return ( return (