File tree Expand file tree Collapse file tree 3 files changed +32
-4
lines changed
features/OrderButton/ui/MakeOrderModal Expand file tree Collapse file tree 3 files changed +32
-4
lines changed Original file line number Diff line number Diff line change 11'use client' ;
22import React from 'react' ;
33import { ModalComponent } from '@/shared/ui/Modal' ;
4- import { useWindowWidth } from '@/shared/hooks' ;
4+ import { useWindowHeight , useWindowWidth } from '@/shared/hooks' ;
55
66type ModalComponentProps = {
77 open : boolean ;
@@ -15,13 +15,16 @@ export const MakeOrderModal: React.FC<ModalComponentProps> = ({
1515 children,
1616} ) => {
1717 const windowWidth = useWindowWidth ( ) ;
18- const width = windowWidth >= 820 ? 800 : '90%' ;
18+ const windowHeight = useWindowHeight ( ) ;
19+ const width = windowWidth >= 820 ? 800 : '85%' ;
20+ const height = windowHeight >= 700 ? 645 : '90%' ;
21+
1922 return (
2023 < ModalComponent
2124 open = { open }
2225 onClose = { onClose }
2326 withControl = { false }
24- style = { { height : 645 , width, border : 'none' } }
27+ style = { { height, width, border : 'none' } }
2528 >
2629 { children }
2730 </ ModalComponent >
Original file line number Diff line number Diff line change @@ -16,3 +16,20 @@ export function useWindowWidth() {
1616
1717 return width ;
1818}
19+
20+ export function useWindowHeight ( ) {
21+ const [ height , setHeight ] = useState (
22+ typeof window !== 'undefined' ? window . innerHeight : 0 ,
23+ ) ;
24+
25+ useEffect ( ( ) => {
26+ const onResize = ( ) => setHeight ( window . innerHeight ) ;
27+ window . addEventListener ( 'resize' , onResize ) ;
28+
29+ return ( ) => {
30+ window . removeEventListener ( 'resize' , onResize ) ;
31+ } ;
32+ } , [ ] ) ;
33+
34+ return height ;
35+ }
Original file line number Diff line number Diff line change @@ -42,6 +42,10 @@ $WIDTH: 800px;
4242 position : relative ;
4343 background-color : #0a0a0a ;
4444
45+ @media (max-width : 820px ) and (max-height : 900px ) {
46+ overflow-y : scroll ;
47+ max-height : 100% ;
48+ }
4549 @media (max-width : 820px ) {
4650 width : 100% ;
4751 padding : 20px ;
@@ -59,7 +63,11 @@ $WIDTH: 800px;
5963 justify-content : center ;
6064 align-items : center ;
6165 @media (max-width : 820px ) {
62- width : 90% ;
66+ width : 100% ;
67+ }
68+
69+ @media (max-width : 820px ) and (max-height : 900px ) {
70+ max-height : 100% ;
6371 }
6472 }
6573 & HeaderLabel {
You can’t perform that action at this time.
0 commit comments