import { Input, styled } from '@nextui-org/react'
import { SyntheticEvent, useState } from 'react'
const StyledForm = styled('form', {
display: 'flex',
alignItems: 'center',
width: '100%',
padding: '0.5rem',
zIndex: 3
} as any)
const InputContainer = styled('div', {
display: 'flex',
justifyContent: 'center',
flexDirection: 'row',
position: 'sticky'
} as any)
const SendButton = styled('button', {
// reset button styles
background: 'transparent',
border: 'none',
padding: 0,
// styles
width: '24px',
margin: '0 10px',
dflex: 'center',
bg: 'linear-gradient(90deg, $secondary, $primary)',
borderRadius: '$rounded',
cursor: 'pointer',
transition: 'opacity 0.25s ease 0s, transform 0.25s ease 0s',
svg: {
size: '100%',
padding: '4px',
transition: 'transform 0.25s ease 0s, opacity 200ms ease-in-out 50ms',
boxShadow: '0 5px 20px -5px rgba(0, 0, 0, 0.1)'
},
'&:hover': {
opacity: 0.8
},
'&:active': {
transform: 'scale(0.9)',
svg: {
transform: 'translate(24px, -24px)',
opacity: 0
}
}
} as any)
const SendIcon = ({
fill = 'currentColor',
filled,
size,
height,
width,
label,
className,
...props
}: any) => {
return (
)
}
interface IProps {
handleSend: (message: string) => void
}
export default function ChatboxInput({ handleSend }: IProps) {
const [message, setMessage] = useState('')
function handleMessageChange(evt: any) {
setMessage(evt.target.value)
}
function onSend(evt: SyntheticEvent) {
evt.preventDefault()
if (message.length > 0) {
handleSend(message)
// Clear the input post-send.
setMessage('')
}
}
return (
}
/>
)
}