Skip to content

Commit

Permalink
фикс
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanNaum committed May 27, 2024
1 parent f4a57bd commit 0822dc0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
7 changes: 6 additions & 1 deletion src/Components/ChatInput/ChatInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ export default class ChatInput extends BaseComponent {
'.popup_stickers_body',
);
this.getConfig().stickers.forEach((sticker) => {
sticker.handler = this.getConfig().stickerSendHandler;
const stickerBlock = new Sticker(stickersBlock, sticker);
stickerBlock.render();
});
stickersBlock.addEventListener('click', (event) => {
const target = event.target;

const stickerId = parseInt(target.id.match(/\d+$/)[0]);
this.getConfig().stickerSendHandler(stickerId);
});
}

render() {
Expand Down
10 changes: 0 additions & 10 deletions src/Components/Sticker/Sticker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,4 @@ import { BaseComponent } from '../BaseComponent.js';

export default class Sticker extends BaseComponent {
templateName = 'Sticker';

render() {
super.render();

this.getParent()
.querySelector(`#sticker_img_${this.getConfig().sticker_id}`)
.addEventListener('click', () => {
this.getConfig().handler(this.getConfig().sticker_id);
});
}
}

0 comments on commit 0822dc0

Please sign in to comment.