Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2464 - Make emoji size slightly larger in the message text #2483

Merged
merged 2 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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.15em;
}
}
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