]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Fix media modal regression on public pages
authorEugen Rochko <eugen@zeonfederated.com>
Fri, 27 Nov 2020 14:41:58 +0000 (15:41 +0100)
committerClaire <claire.github-309c@sitedethib.com>
Fri, 7 May 2021 20:47:09 +0000 (22:47 +0200)
Port e1a6526c8dccec4464667b422cc2336b28504d2c to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
app/javascript/flavours/glitch/containers/media_container.js

index a483510b07e36a88576a29ad5f7f7b3e9545f873..ab5f68770ca68d4912e76d57fd25796c76116664 100644 (file)
@@ -30,6 +30,7 @@ export default class MediaContainer extends PureComponent {
     media: null,
     index: null,
     time: null,
+    backgroundColor: null,
   };
 
   handleOpenMedia = (media, index) => {
@@ -52,7 +53,16 @@ export default class MediaContainer extends PureComponent {
     document.body.classList.remove('with-modals--active');
     document.documentElement.style.marginRight = 0;
 
-    this.setState({ media: null, index: null, time: null });
+    this.setState({
+      media: null,
+      index: null,
+      time: null,
+      backgroundColor: null,
+    });
+  }
+
+  setBackgroundColor = color => {
+    this.setState({ backgroundColor: color });
   }
 
   render () {
@@ -85,13 +95,14 @@ export default class MediaContainer extends PureComponent {
             );
           })}
 
-          <ModalRoot onClose={this.handleCloseMedia}>
+          <ModalRoot backgroundColor={this.state.backgroundColor} onClose={this.handleCloseMedia}>
             {this.state.media && (
               <MediaModal
                 media={this.state.media}
                 index={this.state.index || 0}
                 time={this.state.time}
                 onClose={this.handleCloseMedia}
+                onChangeBackgroundColor={this.setBackgroundColor}
               />
             )}
           </ModalRoot>