]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Bump react-redux-loading-bar from 4.0.8 to 5.0.4
authorYamagishi Kazutoshi <ykzts@desire.sh>
Wed, 20 Jul 2022 11:56:44 +0000 (20:56 +0900)
committeraescling <aescling+gitlab@cat.family>
Mon, 5 Sep 2022 04:27:57 +0000 (00:27 -0400)
Port d5ca204e89377ebce72a06eaf318c9ff848b2187 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
app/javascript/flavours/glitch/features/ui/components/image_loader.js
app/javascript/flavours/glitch/styles/components/index.scss

index c6f16a79237e44ee6cd205e5e2196045c3bbe222..dfa0efe49b76c54f392448966a4672a137154880 100644 (file)
@@ -1,10 +1,10 @@
-import React from 'react';
-import PropTypes from 'prop-types';
 import classNames from 'classnames';
+import PropTypes from 'prop-types';
+import React, { PureComponent } from 'react';
 import { LoadingBar } from 'react-redux-loading-bar';
 import ZoomableImage from './zoomable_image';
 
-export default class ImageLoader extends React.PureComponent {
+export default class ImageLoader extends PureComponent {
 
   static propTypes = {
     alt: PropTypes.string,
@@ -43,7 +43,7 @@ export default class ImageLoader extends React.PureComponent {
     this.loadImage(this.props);
   }
 
-  componentWillReceiveProps (nextProps) {
+  UNSAFE_componentWillReceiveProps (nextProps) {
     if (this.props.src !== nextProps.src) {
       this.loadImage(nextProps);
     }
@@ -139,14 +139,18 @@ export default class ImageLoader extends React.PureComponent {
 
     return (
       <div className={className}>
-        <LoadingBar loading={loading ? 1 : 0} className='loading-bar' style={{ width: this.state.width || width }} />
         {loading ? (
-          <canvas
-            className='image-loader__preview-canvas'
-            ref={this.setCanvasRef}
-            width={width}
-            height={height}
-          />
+          <>
+            <div className='loading-bar__container' style={{ width: this.state.width || width }}>
+              <LoadingBar className='loading-bar' loading={1} />
+            </div>
+            <canvas
+              className='image-loader__preview-canvas'
+              ref={this.setCanvasRef}
+              width={width}
+              height={height}
+            />
+          </>
         ) : (
           <ZoomableImage
             alt={alt}
index 7f9ed2186037e3db9206df6075993af282ebcb46..b54c3f6961e2d6bb9b4d37655404f391c1aa378f 100644 (file)
     object-fit: contain;
   }
 
-  .loading-bar {
+  .loading-bar__container {
     position: relative;
   }
 
+  .loading-bar {
+    position: absolute;
+  }
+
   &.image-loader--amorphous .image-loader__preview-canvas {
     display: none;
   }