Skip to content

Commit

Permalink
fix(chat): Fix scrollable
Browse files Browse the repository at this point in the history
  • Loading branch information
marker dao ® committed Sep 4, 2024
1 parent 6bb9fb6 commit 17dfb0c
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
$messagegroup-gap,
$messagegroup-start-template,
$messagegroup-start-gap,
$messagegroup-padding-top,
$information-font-size,
$information-color,
$information-gap
) {
.dx-chat-message-group {
row-gap: $messagegroup-gap;

&:not(&:first-child) {
padding-top: $messagegroup-padding-top;
}
}

.dx-chat-message-group-information {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
@mixin chat-messagelist(
$padding,
$gap
) {
@mixin chat-messagelist($padding) {
.dx-chat-message-list {
padding: $padding 0;

.dx-scrollable-content {
padding: $padding;
row-gap: $gap;
padding: 0 $padding;
}
}
}
6 changes: 2 additions & 4 deletions packages/devextreme-scss/scss/widgets/fluent/chat/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@
$chat-messagegroup-gap,
$chat-messagegroup-alignment-start-template,
$chat-messagegroup-alignment-start-gap,
$chat-messagegroup-padding-top,
$chat-information-font-size,
$chat-information-color,
$chat-information-gap
);
@include chat-messagelist(
$chat-messagelist-padding,
$chat-messagelist-gap
);
@include chat-messagelist($chat-messagelist-padding);
6 changes: 3 additions & 3 deletions packages/devextreme-scss/scss/widgets/fluent/chat/_sizes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $chat-messagebox-button-size: null !default;
$chat-messagebox-gap: 8px !default;
$chat-messagelist-padding: null !default;
$chat-messagegroup-gap: 4px !default;
$chat-messagelist-gap: null !default;
$chat-messagegroup-padding-top: null !default;
$chat-information-gap: 8px !default;
$chat-avatar-size: 32px !default;
$chat-messagegroup-alignment-start-template: auto 1fr !default;
Expand All @@ -28,7 +28,7 @@ $chat-information-font-size: 12px !default;
$chat-messagebox-textarea-min-height: 40px !default;
$chat-messagebox-button-size: 32px !default;
$chat-messagelist-padding: 20px !default;
$chat-messagelist-gap: 24px !default;
$chat-messagegroup-padding-top: 24px !default;
}

@else if $size == "compact" {
Expand All @@ -38,5 +38,5 @@ $chat-information-font-size: 12px !default;
$chat-messagebox-textarea-min-height: 32px !default;
$chat-messagebox-button-size: 24px !default;
$chat-messagelist-padding: 16px !default;
$chat-messagelist-gap: 12px !default;
$chat-messagegroup-padding-top: 12px !default;
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@
$chat-messagegroup-gap,
$chat-messagegroup-alignment-start-template,
$chat-messagegroup-alignment-start-gap,
$chat-messagegroup-padding-top,
$chat-information-font-size,
$chat-information-color,
$chat-information-gap
);
@include chat-messagelist(
$chat-messagelist-padding,
$chat-messagelist-gap
);
@include chat-messagelist($chat-messagelist-padding);
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $chat-messagebox-button-size: null !default;
$chat-messagebox-gap: 8px !default;
$chat-messagelist-padding: null !default;
$chat-messagegroup-gap: 4px !default;
$chat-messagelist-gap: null !default;
$chat-messagegroup-padding-top: null !default;
$chat-information-gap: 8px !default;
$chat-avatar-size: 32px !default;
$chat-messagegroup-alignment-start-template: auto 1fr !default;
Expand All @@ -28,7 +28,7 @@ $chat-information-font-size: 12px !default;
$chat-messagebox-textarea-border-radius: 4px !default;
$chat-messagebox-button-size: 34px !default;
$chat-messagelist-padding: 20px !default;
$chat-messagelist-gap: 24px !default;
$chat-messagegroup-padding-top: 24px !default;
}

@else if $size == "compact" {
Expand All @@ -39,5 +39,5 @@ $chat-information-font-size: 12px !default;
$chat-messagebox-textarea-border-radius: 4px !default;
$chat-messagebox-button-size: 24px !default;
$chat-messagelist-padding: 16px !default;
$chat-messagelist-gap: 12px !default;
$chat-messagegroup-padding-top: 12px !default;
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@
$chat-messagegroup-gap,
$chat-messagegroup-alignment-start-template,
$chat-messagegroup-alignment-start-gap,
$chat-messagegroup-padding-top,
$chat-information-font-size,
$chat-information-color,
$chat-information-gap
);
@include chat-messagelist(
$chat-messagelist-padding,
$chat-messagelist-gap
);
@include chat-messagelist($chat-messagelist-padding);
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $chat-messagebox-button-size: null !default;
$chat-messagebox-gap: 8px !default;
$chat-messagelist-padding: null !default;
$chat-messagegroup-gap: 4px !default;
$chat-messagelist-gap: null !default;
$chat-messagegroup-padding-top: null !default;
$chat-information-gap: 8px !default;
$chat-avatar-size: 32px !default;
$chat-messagegroup-alignment-start-template: auto 1fr !default;
Expand All @@ -28,7 +28,7 @@ $chat-information-font-size: 12px !default;
$chat-messagebox-textarea-border-radius: 8px !default;
$chat-messagebox-button-size: 36px !default;
$chat-messagelist-padding: 20px !default;
$chat-messagelist-gap: 24px !default;
$chat-messagegroup-padding-top: 24px !default;
}

@else if $size == "compact" {
Expand All @@ -39,5 +39,5 @@ $chat-information-font-size: 12px !default;
$chat-messagebox-textarea-border-radius: 4px !default;
$chat-messagebox-button-size: 28px !default;
$chat-messagelist-padding: 16px !default;
$chat-messagelist-gap: 12px !default;
$chat-messagegroup-padding-top: 12px !default;
}
10 changes: 6 additions & 4 deletions packages/devextreme/js/__internal/ui/chat/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ class Chat extends Widget<Properties> {

super._initMarkup();

this._renderMessageBox();
this._renderMessageList();

const { title } = this.option();

if (title) {
this._renderHeader(title);
}

this._renderMessageList();
this._renderMessageBox();
}

_renderHeader(title: string): void {
Expand All @@ -76,7 +76,9 @@ class Chat extends Widget<Properties> {
const { items = [], user } = this.option();

const currentUserId = user?.id;
const $messageList = $('<div>').appendTo(this.element());
const $messageList = $('<div>');

this.element().prepend($messageList.get(0));

this._messageList = this._createComponent($messageList, MessageList, {
items,
Expand Down

0 comments on commit 17dfb0c

Please sign in to comment.