Skip to content
Snippets Groups Projects
Commit b8a4ada3 authored by insert's avatar insert
Browse files

Fix: Padding on message box.

Allow 20 max rows on message area.
parent c246c2b7
No related merge requests found
...@@ -61,13 +61,18 @@ export type UploadState = ...@@ -61,13 +61,18 @@ export type UploadState =
const Base = styled.div` const Base = styled.div`
display: flex; display: flex;
/*padding: 0 12px;*/ align-items: flex-start;
background: var(--message-box); background: var(--message-box);
textarea { textarea {
font-size: 0.875rem; font-size: 0.875rem;
background: transparent; background: transparent;
} }
.textarea {
flex-grow: 1;
padding: 12px 0;
}
`; `;
const Blocked = styled.div` const Blocked = styled.div`
...@@ -419,62 +424,64 @@ function MessageBox({ channel, draft }: Props) { ...@@ -419,62 +424,64 @@ function MessageBox({ channel, draft }: Props) {
/> />
</Action> </Action>
) : undefined} ) : undefined}
<TextAreaAutoSize <div class="textarea">
autoFocus <TextAreaAutoSize
hideBorder autoFocus
maxRows={5} hideBorder
padding={14} maxRows={20}
id="message" padding={0}
value={draft ?? ""} id="message"
onKeyUp={onKeyUp} value={draft ?? ""}
onKeyDown={(e) => { onKeyUp={onKeyUp}
if (onKeyDown(e)) return; onKeyDown={(e) => {
if (onKeyDown(e)) return;
if (
e.key === "ArrowUp" && if (
(!draft || draft.length === 0) e.key === "ArrowUp" &&
) { (!draft || draft.length === 0)
e.preventDefault(); ) {
internalEmit("MessageRenderer", "edit_last"); e.preventDefault();
return; internalEmit("MessageRenderer", "edit_last");
} return;
}
if ( if (
!e.shiftKey && !e.shiftKey &&
e.key === "Enter" && e.key === "Enter" &&
!isTouchscreenDevice !isTouchscreenDevice
) { ) {
e.preventDefault(); e.preventDefault();
return send(); return send();
} }
debouncedStopTyping(true); debouncedStopTyping(true);
}} }}
placeholder={ placeholder={
channel.channel_type === "DirectMessage" channel.channel_type === "DirectMessage"
? translate("app.main.channel.message_who", { ? translate("app.main.channel.message_who", {
person: client.users.get( person: client.users.get(
client.channels.getRecipient(channel._id), client.channels.getRecipient(channel._id),
)?.username, )?.username,
}) })
: channel.channel_type === "SavedMessages" : channel.channel_type === "SavedMessages"
? translate("app.main.channel.message_saved") ? translate("app.main.channel.message_saved")
: translate("app.main.channel.message_where", { : translate("app.main.channel.message_where", {
channel_name: channel.name, channel_name: channel.name,
}) })
} }
disabled={ disabled={
uploadState.type === "uploading" || uploadState.type === "uploading" ||
uploadState.type === "sending" uploadState.type === "sending"
} }
onChange={(e) => { onChange={(e) => {
setMessage(e.currentTarget.value); setMessage(e.currentTarget.value);
startTyping(); startTyping();
onChange(e); onChange(e);
}} }}
onFocus={onFocus} onFocus={onFocus}
onBlur={onBlur} onBlur={onBlur}
/> />
</div>
{isTouchscreenDevice && ( {isTouchscreenDevice && (
<Action> <Action>
<IconButton onClick={send}> <IconButton onClick={send}>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment