Skip to content

Commit 1b86f8b

Browse files
feat: added adaptivity to crm table modal
1 parent 470185f commit 1b86f8b

File tree

6 files changed

+40
-3
lines changed

6 files changed

+40
-3
lines changed

src/widgets/CRMDashboard/Table/ui/TableModal/index.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use client';
2-
import React from 'react';
2+
import React, { useMemo } from 'react';
33
import { ModalComponent } from '@/shared/ui/Modal';
44
import { crmPreviewModalState } from '@/shared/state/crmPreviewModal/state';
55
import { observer } from 'mobx-react-lite';
@@ -8,21 +8,33 @@ import { EditDataField } from './ui/EditDataField';
88
import { DeleteBtn } from './ui/DeleteBtn';
99
import s from './style.module.scss';
1010
import { Preview3DModel } from './ui/Preview3DModel';
11+
import { useWindowWidth } from '@/shared/hooks';
1112

1213
export const TableModal = observer(() => {
14+
const width = useWindowWidth();
1315
const open = crmPreviewModalState.modalOpen;
1416
const loading = crmPreviewModalState.deletePending;
1517
const handleClose = () => {
1618
crmPreviewModalState.modalOpen = false;
1719
crmPreviewModalState.resetAllFields();
1820
};
21+
const isPrintOrder = crmPreviewModalState.orderType === 'print_order';
22+
23+
const modalWidth = isPrintOrder ? 880 : 440;
24+
25+
const style = useMemo(() => {
26+
return {
27+
width: width >= modalWidth ? modalWidth : width - 20,
28+
height: 'fitContent',
29+
};
30+
}, [width, modalWidth]);
1931
return (
2032
<ModalComponent
2133
open={open}
2234
loading={loading}
2335
withControl={false}
2436
onClose={handleClose}
25-
style={{ width: 800, height: 'fitContent' }}
37+
style={style}
2638
>
2739
{crmPreviewModalState.orderType === 'print_order' ? (
2840
<div className={s.metaContainer}>

src/widgets/CRMDashboard/Table/ui/TableModal/style.module.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
justify-content: flex-start;
88
box-sizing: border-box;
99
padding: 0;
10+
11+
@media (max-width: 880px) {
12+
width: 95%;
13+
flex-direction: column-reverse;
14+
}
1015
}
1116
.container {
1217
width: 100%;

src/widgets/CRMDashboard/Table/ui/TableModal/ui/EditDataField/Fields/OrderAdditionalsField/style.module.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
}
1616
&Label {
1717
font-size: 14px;
18+
@media (max-width: 440px) {
19+
font-size: 12px;
20+
}
1821
}
1922
}
2023

src/widgets/CRMDashboard/Table/ui/TableModal/ui/EditDataField/style.module.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@
1111
width: 150px;
1212
height: 30px;
1313
font-size: 14px;
14+
@media (max-width: 440px) {
15+
font-size: 12px;
16+
}
1417
}
1518
&Field {
1619
width: fit-content;
1720
height: 30px;
1821
font-size: 14px;
22+
@media (max-width: 440px) {
23+
font-size: 12px;
24+
}
1925
}
2026
}

src/widgets/CRMDashboard/Table/ui/TableModal/ui/Preview3DModel/ui/Controls/style.module.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
span {
2020
display: block;
2121
}
22+
@media (max-width: 440px) {
23+
font-size: 12px;
24+
}
2225
&WithPow {
2326
box-sizing: border-box;
2427
width: fit-content;
@@ -32,5 +35,8 @@
3235
span {
3336
display: block;
3437
}
38+
@media (max-width: 440px) {
39+
font-size: 12px;
40+
}
3541
}
3642
}

src/widgets/CRMDashboard/Table/ui/TableModal/ui/ShowDataField/style.module.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,17 @@
1111
width: 150px;
1212
height: 30px;
1313
font-size: 14px;
14+
@media (max-width: 440px) {
15+
font-size: 12px;
16+
}
1417
}
1518
&Field {
1619
width: fit-content;
1720
height: 30px;
1821
font-size: 14px;
19-
22+
@media (max-width: 440px) {
23+
font-size: 12px;
24+
}
2025
&Value {
2126
width: 200px;
2227
overflow: hidden;

0 commit comments

Comments
 (0)