Skip to content

Commit 0c6cb58

Browse files
committed
Chat FU: rework styles to make several files showing in a one row
1 parent b5a9487 commit 0c6cb58

File tree

5 files changed

+31
-4
lines changed

5 files changed

+31
-4
lines changed

packages/devextreme-scss/scss/widgets/base/chat/layout/chat-messagebox/_index.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
.dx-fileuploader-wrapper {
3434
padding: 0;
3535
}
36+
37+
.dx-fileuploader-files-container {
38+
display: grid;
39+
}
3640
}
3741

3842
.dx-chat-textarea-toolbar.dx-toolbar {

packages/devextreme-scss/scss/widgets/base/chat/layout/chat-messagebox/_mixins.scss

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
$gap,
55
$textarea-border-radius,
66
$textarea-padding,
7-
$toolbar-min-height
7+
$toolbar-min-height,
8+
$chat-file-container-width,
9+
$messagebox-file-container-padding,
10+
$messagebox-file-container-padding-top,
811
) {
912
.dx-chat-messagebox {
1013
padding: $messagebox-padding;
@@ -29,6 +32,13 @@
2932
border-bottom-right-radius: $textarea-border-radius;
3033
}
3134
}
35+
36+
.dx-fileuploader-files-container {
37+
padding: 2px 3px 3px 3px;
38+
gap: $gap;
39+
grid-template-columns: repeat(auto-fit, $chat-file-container-width);
40+
min-width: $chat-file-container-width;
41+
}
3242
}
3343

3444
.dx-chat-textarea-toolbar.dx-toolbar {

packages/devextreme-scss/scss/widgets/fluent/chat/_index.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
$chat-messagebox-textarea-border-radius,
4747
$chat-messagebox-textarea-padding,
4848
$chat-messagebox-toolbar-min-height,
49+
$chat-file-container-width,
50+
$chat-messagebox-file-container-padding,
51+
$chat-messagebox-file-container-padding-top,
4952
);
5053
@include chat-messagebubble(
5154
$chat-bubble-padding,

packages/devextreme-scss/scss/widgets/fluent/chat/_sizes.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ $chat-messagebox-textarea-padding: null !default;
1818
$chat-messagebox-textarea-border-radius: null !default;
1919
$chat-messagebox-toolbar-min-height: null !default;
2020
$chat-messagebox-gap: 8px !default;
21+
$chat-messagebox-file-container-padding: 3px !default;
22+
$chat-messagebox-file-container-padding-top: 2px !default;
2123
$chat-messagelist-padding: null !default;
2224
$chat-messagegroup-gap: 4px !default;
2325
$chat-messagegroup-padding: null !default;

packages/devextreme/js/__internal/ui/file_uploader/file_uploader.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,9 @@ class FileUploader extends Editor<FileUploaderProperties> {
776776
}
777777

778778
_updateFileNameMaxWidth(): void {
779-
const { allowCanceling, uploadMode } = this.option();
779+
// eslint-disable-next-line @typescript-eslint/naming-convention
780+
const { allowCanceling, uploadMode, _showFileIcon } = this.option();
781+
780782
const cancelButtonsCount = allowCanceling && uploadMode !== 'useForm' ? 1 : 0;
781783
const uploadButtonsCount = uploadMode === 'useButtons' ? 1 : 0;
782784
const filesContainerWidth = getWidth(
@@ -785,13 +787,15 @@ class FileUploader extends Editor<FileUploaderProperties> {
785787
const $buttonContainer = this._$filesContainer?.find(`.${FILEUPLOADER_BUTTON_CONTAINER_CLASS}`).eq(0);
786788
const buttonsWidth = getWidth($buttonContainer) * (cancelButtonsCount + uploadButtonsCount);
787789
const $fileSize = this._$filesContainer?.find(`.${FILEUPLOADER_FILE_SIZE_CLASS}`).eq(0);
788-
790+
const $icon = this._$filesContainer?.find(`.${FILEUPLOADER_FILE_ICON_CLASS}`).eq(0);
791+
const iconWidth = _showFileIcon ? getWidth($icon) : 0;
792+
debugger;
789793
const prevFileSize = $fileSize?.text();
790794
$fileSize?.text('1000 Mb');
791795
const fileSizeWidth = getWidth($fileSize);
792796
$fileSize?.text(prevFileSize ?? '');
793797

794-
this._$filesContainer?.find(`.${FILEUPLOADER_FILE_NAME_CLASS}`).css('maxWidth', filesContainerWidth - buttonsWidth - fileSizeWidth);
798+
this._$filesContainer?.find(`.${FILEUPLOADER_FILE_NAME_CLASS}`).css('maxWidth', filesContainerWidth - buttonsWidth - fileSizeWidth - iconWidth);
795799
}
796800

797801
_renderFileButtons(file: FileUploaderItem, $container: dxElementWrapper): void {
@@ -1745,6 +1749,10 @@ class FileUploader extends Editor<FileUploaderProperties> {
17451749
this._initFileInput();
17461750
super._optionChanged(args);
17471751
break;
1752+
case 'visible':
1753+
super._optionChanged(args);
1754+
this._updateFileNameMaxWidth();
1755+
break;
17481756
default:
17491757
super._optionChanged(args);
17501758
}

0 commit comments

Comments
 (0)