Skip to content

Commit e563ed7

Browse files
feat: enhance modal and form responsiveness with dynamic sizing and adaptive styles
1 parent a0617c5 commit e563ed7

File tree

6 files changed

+41
-2
lines changed

6 files changed

+41
-2
lines changed

src/features/OrderButton/ui/MakeOrderModal/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use client';
22
import React from 'react';
33
import { ModalComponent } from '@/shared/ui/Modal';
4+
import { useWindowWidth } from '@/shared/hooks';
45

56
type ModalComponentProps = {
67
open: boolean;
@@ -13,12 +14,14 @@ export const MakeOrderModal: React.FC<ModalComponentProps> = ({
1314
onClose = () => {},
1415
children,
1516
}) => {
17+
const windowWidth = useWindowWidth();
18+
const width = windowWidth >= 820 ? 800 : '90%';
1619
return (
1720
<ModalComponent
1821
open={open}
1922
onClose={onClose}
2023
withControl={false}
21-
style={{ height: 645, width: 800, border: 'none' }}
24+
style={{ height: 645, width, border: 'none' }}
2225
>
2326
{children}
2427
</ModalComponent>

src/features/OrderConsultationButton/ui/OrderConsultationModal/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import React from 'react';
33
import { ModalComponent } from '@/shared/ui/Modal';
44
import { OrderConsultationForm } from './ui/OrderConsultationForm';
5+
import { useWindowWidth } from '@/shared/hooks';
56

67
type ModalComponentProps = {
78
open: boolean;
@@ -12,12 +13,17 @@ export const OrderConsultationModal: React.FC<ModalComponentProps> = ({
1213
open,
1314
onClose = () => {},
1415
}) => {
16+
const windowWidth = useWindowWidth();
17+
const style =
18+
windowWidth >= 420
19+
? { height: 190 }
20+
: { height: 'fitContent', width: '90%' };
1521
return (
1622
<ModalComponent
1723
open={open}
1824
onClose={onClose}
1925
withControl={false}
20-
style={{ height: 190 }}
26+
style={style}
2127
>
2228
<OrderConsultationForm />
2329
</ModalComponent>

src/features/OrderConsultationButton/ui/OrderConsultationModal/ui/OrderConsultationForm/SubmitButton/style.module.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@
1313
width: 300px;
1414
height: 35px;
1515
text-align: center;
16+
17+
@media (max-width: 310px) {
18+
width: fit-content;
19+
height: fit-content;
20+
min-height: 35px;
21+
box-sizing: border-box;
22+
padding-right: 10px;
23+
padding-left: 10px;
24+
}
1625
}
1726

1827
&:hover {

src/features/OrderConsultationButton/ui/OrderConsultationModal/ui/OrderConsultationForm/style.module.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,16 @@
1414
align-items: center;
1515
box-sizing: border-box;
1616
height: 50px;
17+
@media (max-width: 420px) {
18+
padding-right: 10px;
19+
padding-left: 10px;
20+
}
1721
span {
1822
color: #e49e00;
1923
font-size: 20px;
24+
@media (max-width: 420px) {
25+
text-align: center;
26+
}
2027
}
2128
&NotAuth {
2229
font-size: 16px;
@@ -32,6 +39,10 @@
3239
padding: 10px;
3340
padding-bottom: 0;
3441

42+
@media (max-width: 420px) {
43+
align-items: center;
44+
}
45+
3546
&Errors {
3647
height: 15px;
3748
width: 80%;

src/shared/ui/FormItem/style.module.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
}
1414
@media (max-width: 520px) {
1515
flex-direction: column;
16+
align-items: center;
1617
gap: 10px;
1718
}
1819
}
@@ -169,6 +170,10 @@
169170
flex-direction: row;
170171
align-items: center;
171172
justify-content: center;
173+
@media (max-width: 370px) {
174+
width: 100%;
175+
flex-direction: column;
176+
}
172177
}
173178

174179
&Item {
@@ -181,6 +186,9 @@
181186
border: 2px solid #e49e00;
182187
padding-right: 4px;
183188
padding-left: 4px;
189+
@media (max-width: 370px) {
190+
width: 100%;
191+
}
184192

185193
&:hover {
186194
color: #e49e00;

src/shared/ui/OrderForm/style.module.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ $WIDTH: 800px;
4040
box-sizing: border-box;
4141
padding: 30px;
4242
position: relative;
43+
background-color: #0a0a0a;
44+
4345
@media (max-width: 820px) {
4446
width: 100%;
4547
padding: 20px;

0 commit comments

Comments
 (0)