Skip to content

Commit

Permalink
#2464 - Make emoji size slightly larger in the message text (#2483)
Browse files Browse the repository at this point in the history
* make emojis look slightly larger

* increse by 20%
  • Loading branch information
SebinSong authored Dec 27, 2024
1 parent b6dc54d commit 25c49c9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 20 deletions.
4 changes: 4 additions & 0 deletions frontend/assets/style/components/_custom-markdowns.scss
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,8 @@
font-size: 0.7rem;
color: var(--text_1);
}

.chat-emoji {
font-size: 1.2em;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,17 @@ export default ({
},
generateTextObjectsFromText (text) {
const containsMentionChar = str => new RegExp(`[${CHATROOM_MEMBER_MENTION_SPECIAL_CHAR}${CHATROOM_CHANNEL_MENTION_SPECIAL_CHAR}]`, 'g').test(text)
const wrapEmojis = str => {
// We should be able to style the emojis in message-text (reference issue: https://github.com/okTurtles/group-income/issues/2464)
return str.replace(/(\p{Emoji})/gu, '<span class="chat-emoji">$1</span>')
}
if (!text) { return [] }
if (!containsMentionChar(text)) {
return [{ type: TextObjectType.Text, text }]
return [{
type: TextObjectType.Text,
text: wrapEmojis(text)
}]
}
const allMention = makeMentionFromUserID('').all
const regExpPossibleMentions = new RegExp(`(?<=\\s|^)(${allMention}|${this.possibleMentions.join('|')})(?=[^\\w\\d]|$)`)
Expand All @@ -105,7 +112,8 @@ export default ({
.split(regExpPossibleMentions)
.map(t => {
const genDefaultTextObj = (text) => ({
type: TextObjectType.Text, text
type: TextObjectType.Text,
text: wrapEmojis(text)
})
const genChannelMentionObj = (text) => {
const chatRoomID = getIdFromChannelMention(text)
Expand Down Expand Up @@ -183,25 +191,27 @@ export default ({
background-color: $warning_1;
}
.c-message-text.is-replying {
border-left: 2px;
border-color: #dbdbdb; // var(--text_1);
border-style: none none none solid;
font-size: 0.75rem;
color: var(--text_1);
font-style: italic;
padding-left: 0.25rem;
white-space: pre-line;
&:hover {
cursor: pointer;
color: var(--text_2);
border-color: var(--text_1); // var(--text_2);
}
.c-message-text {
&.is-replying {
border-left: 2px;
border-color: #dbdbdb; // var(--text_1);
border-style: none none none solid;
font-size: 0.75rem;
color: var(--text_1);
font-style: italic;
padding-left: 0.25rem;
white-space: pre-line;
&:hover {
cursor: pointer;
color: var(--text_2);
border-color: var(--text_1); // var(--text_2);
}
.c-member-mention,
.c-channel-mention {
background-color: transparent;
.c-member-mention,
.c-channel-mention {
background-color: transparent;
}
}
}
Expand Down

0 comments on commit 25c49c9

Please sign in to comment.