Skip to content

Commit 45ccac3

Browse files
committed
refactor(chat): apply dragging part
1 parent 4b9355a commit 45ccac3

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/components/chat/chat-input.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export default class IgcChatInputComponent extends LitElement {
7878
private inputPlaceholder = '';
7979

8080
@state()
81-
private dragClass = '';
81+
private dragPart = '';
8282

8383
constructor() {
8484
super();
@@ -216,7 +216,7 @@ export default class IgcChatInputComponent extends LitElement {
216216
this._chatState?.isFileTypeAccepted(item.getAsFile() as File, item.type)
217217
);
218218

219-
this.dragClass = hasValidFiles ? 'dragging' : '';
219+
this.dragPart = hasValidFiles ? 'dragging' : '';
220220

221221
this._chatState?.emitEvent('igcAttachmentDrag');
222222
}
@@ -241,14 +241,14 @@ export default class IgcChatInputComponent extends LitElement {
241241
y <= rect.top ||
242242
y >= rect.bottom
243243
) {
244-
this.dragClass = '';
244+
this.dragPart = '';
245245
}
246246
}
247247

248248
private handleDrop(e: DragEvent) {
249249
e.preventDefault();
250250
e.stopPropagation();
251-
this.dragClass = '';
251+
this.dragPart = '';
252252

253253
const files = Array.from(e.dataTransfer?.files || []);
254254
if (files.length === 0) return;
@@ -330,7 +330,7 @@ export default class IgcChatInputComponent extends LitElement {
330330

331331
protected override render() {
332332
return html`
333-
<div part="input-container" class="${this.dragClass}">
333+
<div part="input-container ${this.dragPart}">
334334
${this._chatState?.inputAttachments &&
335335
this._chatState?.inputAttachments.length > 0
336336
? this.renderAttachmentsArea()

src/components/chat/chat.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ describe('Chat', () => {
209209
const inputArea = chat.shadowRoot?.querySelector('igc-chat-input');
210210

211211
expect(inputArea).shadowDom.to.equal(
212-
`<div part="input-container">
212+
`<div part="input-container ">
213213
<div part="input-wrapper">
214214
<igc-textarea
215215
part="text-input"
@@ -500,7 +500,7 @@ describe('Chat', () => {
500500
const inputArea = chat.shadowRoot?.querySelector('igc-chat-input');
501501

502502
expect(inputArea).shadowDom.to.equal(
503-
`<div part="input-container">
503+
`<div part="input-container ">
504504
<div part="input-wrapper">
505505
<igc-textarea
506506
part="text-input"
@@ -562,7 +562,7 @@ describe('Chat', () => {
562562
expect(eventArgs).to.deep.equal(args);
563563

564564
expect(inputArea).shadowDom.to.equal(
565-
`<div part="input-container">
565+
`<div part="input-container ">
566566
<div aria-label="Attachments" part="attachments" role="list">
567567
<div part="attachment-wrapper" role="listitem">
568568
<igc-chip removable="">
@@ -982,7 +982,7 @@ describe('Chat', () => {
982982
const inputArea = chat.shadowRoot?.querySelector('igc-chat-input');
983983

984984
expect(inputArea).shadowDom.to.equal(
985-
`<div part="input-container">
985+
`<div part="input-container ">
986986
<div aria-label="Attachments" part="attachments" role="list">
987987
<div>
988988
<a href=${draftMessage.attachments[0].url} target="_blank">

0 commit comments

Comments
 (0)