Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 24 additions & 16 deletions src/bubble-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ interface BubbleInputProps {
strokeColour: string
}

const BubbleInput = ({ onChange, onSubmit, value, fillColour, strokeColour }: BubbleInputProps) => {
const BubbleInput = ({
onChange,
onSubmit,
value,
fillColour,
strokeColour
}: BubbleInputProps) => {
const refEditable = useRef<HTMLDivElement>(null)
const refContainer = useRef<HTMLDivElement>(null)
const [submitted, setSubmitted] = useState(false)
Expand Down Expand Up @@ -48,22 +54,24 @@ const BubbleInput = ({ onChange, onSubmit, value, fillColour, strokeColour }: Bu
useEffect(handleBlur, [handleBlur])

return (
<div
ref={refContainer}
className={`bubble input ${value.length === 0 ? 'empty' : ''} ${
submitted ? 'submitted' : ''
}`}
>
<div className="bubble-container">
<div
ref={refEditable}
className="bubble-content"
contentEditable
style={{backgroundColor: fillColour, color: strokeColour}}
spellCheck="false"
onBlur={handleBlur}
onKeyDown={handleKeyDown}
onInput={e => onChange(e.currentTarget.innerText)}
/>
ref={refContainer}
className={`bubble input ${value.length === 0 ? 'empty' : ''} ${
submitted ? 'submitted' : ''
}`}
>
<div
ref={refEditable}
className="bubble-content"
contentEditable
style={{ backgroundColor: fillColour, color: strokeColour }}
spellCheck="false"
onBlur={handleBlur}
onKeyDown={handleKeyDown}
onInput={e => onChange(e.currentTarget.innerText)}
/>
</div>
</div>
)
}
Expand Down
9 changes: 6 additions & 3 deletions src/bubble.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
width: 100%;
color: var(--bubble-color);
}

.bubble-container {
height: 200px;
width: 100%;
}
.bubble-content {
background-color: var(--background-color);
border-radius: 30px;
Expand Down Expand Up @@ -34,10 +37,10 @@

.bubble:last-child .bubble-content:after,
.bubble:nth-last-child(2) .bubble-content:after {
background: #00a000!important;
background: #00a000 !important;
border-bottom-right-radius: 15px;
bottom: 0;
content: "";
content: '';
height: 27px;
left: -15px;
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion src/chat.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.chat {
padding-left: 86px;
padding-bottom: 200px;
padding-bottom: 50px;

display: flex;
flex-flow: column wrap;
Expand Down