Skip to content

Commit 1b206b1

Browse files
authored
feat: adding the possibility to use emoji default of system (#497)
* fix: add component path * add span tag and verification string * adding more verification to emoji string * add span tag and verification string * Update package.json
1 parent 056368b commit 1b206b1

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

packages/core/src/components/discord-reaction/DiscordReaction.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { consume } from '@lit/context';
22
import { css, html, LitElement } from 'lit';
33
import { customElement, property } from 'lit/decorators.js';
44
import { ifDefined } from 'lit/directives/if-defined.js';
5+
import { when } from 'lit/directives/when.js';
56
import type { LightTheme } from '../../types.js';
67
import { messagesLightTheme } from '../discord-messages/DiscordMessages.js';
78

@@ -131,7 +132,11 @@ export class DiscordReaction extends LitElement implements LightTheme {
131132

132133
protected override render() {
133134
return html`<div class="discord-reaction-inner" @click=${this.handleReactionClick} @keydown=${this.handleReactionClick}>
134-
<img src=${ifDefined(this.emoji)} alt=${ifDefined(this.name)} draggable="false" />
135+
${when(
136+
this.emoji.includes('http') || this.emoji.startsWith('/') || this.emoji.startsWith('./'),
137+
() => html`<img src=${ifDefined(this.emoji)} alt=${ifDefined(this.name)} draggable="false" />`,
138+
() => html`<span>${this.emoji}</span>`
139+
)}
135140
<span class="discord-reaction-count">${this.count}</span>
136141
</div>`;
137142
}

packages/core/src/components/discord-string-select-menu-option/DiscordStringSelectMenuOption.ts

+12-9
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,18 @@ export class DiscordStringSelectMenuOption extends LitElement implements LightTh
9898

9999
return html`
100100
<label>
101-
${when(
102-
this.emoji,
103-
() =>
104-
html`<img
105-
src=${this.emoji}
106-
alt=${ifDefined(this.emojiName)}
107-
draggable="true"
108-
class="discord-string-select-menu-option-emoji"
109-
/>`
101+
${when(this.emoji, () =>
102+
when(
103+
this.emoji.includes('http') || this.emoji.startsWith('/') || this.emoji.startsWith('./'),
104+
() =>
105+
html`<img
106+
src=${this.emoji}
107+
alt=${ifDefined(this.emojiName)}
108+
draggable="true"
109+
class="discord-string-select-menu-option-emoji"
110+
/>`,
111+
() => html`<span class="discord-string-select-menu-option-emoji">${this.emoji}</span>`
112+
)
110113
)}
111114
<div class="discord-string-select-menu-option-ellipsis-text">
112115
<div class="discord-string-select-menu-option-ellipsis-text">

0 commit comments

Comments
 (0)