diff --git a/packages/react/src/components/ChatInput/ChatInput.js b/packages/react/src/components/ChatInput/ChatInput.js index 6df8f06d4..576c34af2 100644 --- a/packages/react/src/components/ChatInput/ChatInput.js +++ b/packages/react/src/components/ChatInput/ChatInput.js @@ -8,7 +8,7 @@ import { useMessageStore, loginModalStore, useChannelStore, - useMemberStore + useMemberStore, } from '../../store'; import ChatInputFormattingToolbar from './ChatInputFormattingToolbar'; import useAttachmentWindowStore from '../../store/attachmentwindow'; @@ -59,7 +59,8 @@ const ChatInput = ({ scrollToBottom }) => { .catch(console.error); RCInstance.getChannelMembers(isChannelPrivate) - .then((channelMembers) => setMembersHandler(channelMembers.members || [])) + .then((channelMembers) => + setMembersHandler(channelMembers.members || [])) .catch(console.error); } }); diff --git a/packages/react/src/components/Markup/elements/Mention.js b/packages/react/src/components/Markup/elements/Mention.js index a0d2f5e8b..d32f85365 100644 --- a/packages/react/src/components/Markup/elements/Mention.js +++ b/packages/react/src/components/Markup/elements/Mention.js @@ -1,5 +1,5 @@ import React from 'react'; -import { css } from '@emotion/react' +import { css } from '@emotion/react'; import PropTypes from 'prop-types'; import { useMemberStore, useUserStore } from '../../../store'; @@ -8,11 +8,17 @@ const Mention = ({ contents }) => { const username = useUserStore((state) => state.username); const mentionStyles = css` - background-color: ${contents.value === 'all' || contents.value === 'here' ? '#f38c39' : - (contents.value === username ? '#ec0d2a' : '#e4e7ea') + background-color: ${contents.value === 'all' || contents.value === 'here' + ? '#f38c39' + : contents.value === username + ? '#ec0d2a' + : '#e4e7ea' }; - color: ${contents.value === 'all' || contents.value === 'here' ? '#ffffff' : - (contents.value === username ? '#ffffff' : '#2f343d') + color: ${contents.value === 'all' || contents.value === 'here' + ? '#ffffff' : + contents.value === username + ? '#ffffff' + : '#2f343d' }; font-weight: bold; cursor: pointer; @@ -20,7 +26,9 @@ const Mention = ({ contents }) => { border-radius: 3px; &:hover { - text-decoration: ${contents.value === 'all' || contents.value === 'here' ? 'none' : 'underline'}; + text-decoration: ${contents.value === 'all' || contents.value === 'here' + ? 'none' + : 'underline'}; } `; @@ -37,11 +45,7 @@ const Mention = ({ contents }) => { return ( <> {hasMember(contents.value) === true ? ( - - {contents.value} - + {contents.value} ) : ( `@${contents.value}` )} diff --git a/packages/react/src/components/Mentions/MembersList.js b/packages/react/src/components/Mentions/MembersList.js index 26c78fe7e..2d4351bba 100644 --- a/packages/react/src/components/Mentions/MembersList.js +++ b/packages/react/src/components/Mentions/MembersList.js @@ -1,7 +1,7 @@ import React, { useEffect } from 'react'; import { css } from '@emotion/react'; -import { Box } from '../Box'; import PropTypes from 'prop-types'; +import { Box } from '../Box'; function MembersList({ mentionIndex, filteredMembers = [], onMemberClick }) { const listStyle = css` @@ -30,10 +30,10 @@ function MembersList({ mentionIndex, filteredMembers = [], onMemberClick }) { const listItemStyle = css` cursor: pointer; - display: flex; - justify-content: space-between; - align-items: center; - padding-left: 0; + display: flex; + justify-content: space-between; + align-items: center; + padding-left: 0; padding-right: 2px; &:hover { @@ -46,7 +46,6 @@ function MembersList({ mentionIndex, filteredMembers = [], onMemberClick }) { font-weight: 600; `; - const handleMemberClick = (selectedItem) => { onMemberClick(selectedItem); }; @@ -55,8 +54,11 @@ function MembersList({ mentionIndex, filteredMembers = [], onMemberClick }) { const handleKeyPress = (event) => { if (event.key === 'Enter') { const selectedItem = - mentionIndex < filteredMembers.length ? filteredMembers[mentionIndex] : - mentionIndex === filteredMembers.length ? 'all' : 'here'; + mentionIndex < filteredMembers.length + ? filteredMembers[mentionIndex] + : mentionIndex === filteredMembers.length + ? 'all' + : 'here'; handleMemberClick(selectedItem); } }; @@ -68,7 +70,6 @@ function MembersList({ mentionIndex, filteredMembers = [], onMemberClick }) { }; }, [mentionIndex, filteredMembers, handleMemberClick]); - return (