Przeglądaj źródła

Fix mobile dialog styling (#1363)

Jed Fox 5 lat temu
rodzic
commit
16a3aa7561
2 zmienionych plików z 12 dodań i 6 usunięć
  1. 5 1
      src/components/Modal.scss
  2. 7 5
      src/components/Modal.tsx

+ 5 - 1
src/components/Modal.scss

@@ -28,12 +28,16 @@
   position: relative;
   z-index: 2;
   width: 100%;
-  max-width: 100%;
+  max-width: var(--max-width);
 
   opacity: 0;
   transform: translateY(10px);
   animation: Modal__content_fade-in 0.1s ease-out 0.05s forwards;
   position: relative;
+
+  @media #{$media-query} {
+    max-width: 100%;
+  }
 }
 
 @keyframes Modal__content_fade-in {

+ 7 - 5
src/components/Modal.tsx

@@ -31,11 +31,13 @@ export function Modal(props: {
       <div className="Modal__background" onClick={props.onCloseRequest}></div>
       <div
         className="Modal__content"
-        style={{
-          maxWidth: props.maxWidth,
-          maxHeight: "100%",
-          overflowY: "scroll",
-        }}
+        style={
+          {
+            "--max-width": `${props.maxWidth}px`,
+            maxHeight: "100%",
+            overflowY: "scroll",
+          } as any
+        }
       >
         {props.children}
       </div>