Browse Source

add a send button on chat for touch screen devices (#1127)

* add a send button on chat for touch screen devices

* cleanup
pull/1106/head
gingervitis 4 years ago committed by GitHub
parent
commit
3b08b50ce0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      webroot/js/components/chat/chat-input.js
  2. 5
      webroot/styles/app.css
  3. 2
      webroot/styles/chat.css

22
webroot/js/components/chat/chat-input.js

@ -232,7 +232,7 @@ export default class ChatInput extends Component {
}); });
} }
handleMessageInputBlur(event) { handleMessageInputBlur() {
this.prepNewLine = false; this.prepNewLine = false;
this.modifierKeyPressed = false; this.modifierKeyPressed = false;
} }
@ -282,7 +282,7 @@ export default class ChatInput extends Component {
render(props, state) { render(props, state) {
const { hasSentFirstChatMessage, inputCharsLeft, inputHTML } = state; const { hasSentFirstChatMessage, inputCharsLeft, inputHTML } = state;
const { inputEnabled, chatDisabled } = props; const { inputEnabled } = props;
const emojiButtonStyle = { const emojiButtonStyle = {
display: this.emojiPicker && inputCharsLeft > 0 ? 'block' : 'none', display: this.emojiPicker && inputCharsLeft > 0 ? 'block' : 'none',
}; };
@ -300,7 +300,7 @@ export default class ChatInput extends Component {
> >
<div <div
id="message-input-wrap" id="message-input-wrap"
class="flex flex-row justify-end appearance-none w-full bg-gray-200 border border-black-500 rounded py-2 px-2 pr-12 my-2 overflow-auto" class="flex flex-row justify-end appearance-none w-full bg-gray-200 border border-black-500 rounded py-2 px-2 pr-20 my-2 overflow-auto"
> >
<${ContentEditable} <${ContentEditable}
id="message-input" id="message-input"
@ -318,8 +318,9 @@ export default class ChatInput extends Component {
</div> </div>
<div <div
id="message-form-actions" id="message-form-actions"
class="absolute flex flex-col w-10 justify-end items-center" class="absolute flex flex-col justify-end items-end mr-4"
> >
<span class="flex flex-row justify-center">
<button <button
ref=${this.emojiPickerButton} ref=${this.emojiPickerButton}
id="emoji-button" id="emoji-button"
@ -327,11 +328,24 @@ export default class ChatInput extends Component {
type="button" type="button"
style=${emojiButtonStyle} style=${emojiButtonStyle}
onclick=${this.handleEmojiButtonClick} onclick=${this.handleEmojiButtonClick}
aria-label="Select an emoji"
disabled=${!inputEnabled} disabled=${!inputEnabled}
> >
<img src="../../../img/smiley.png" /> <img src="../../../img/smiley.png" />
</button> </button>
<button
id="send-message-button"
class="text-sm text-white rounded bg-gray-600 hidden p-1 ml-1 -mr-2"
type="button"
onclick=${this.handleSubmitChatButton}
disabled=${inputHTML === '' || inputCharsLeft < 0}
aria-label="Send message"
>
Send
</button>
</span>
<span id="message-form-warning" class="text-red-600 text-xs" <span id="message-form-warning" class="text-red-600 text-xs"
>${inputCharsLeft}/${CHAT_MAX_MESSAGE_LENGTH}</span >${inputCharsLeft}/${CHAT_MAX_MESSAGE_LENGTH}</span
> >

5
webroot/styles/app.css

@ -175,6 +175,11 @@ header {
min-height: auto; min-height: auto;
} }
/* display `send` button on mobile */
.touch-screen #send-message-button{
display: inline-block;
}
/* *********** single col layout ***************************** */ /* *********** single col layout ***************************** */

2
webroot/styles/chat.css

@ -31,7 +31,7 @@
max-height: 5rem; max-height: 5rem;
} }
#message-form-actions { #message-form-actions {
right: 2rem; right: 1rem;
bottom: 1.88rem; bottom: 1.88rem;
} }
#emoji-button { #emoji-button {

Loading…
Cancel
Save