From aa45bc39385ff8568c77a7a07e4dc93db4ca7d72 Mon Sep 17 00:00:00 2001 From: ta264 Date: Mon, 7 Jun 2021 20:54:59 +0100 Subject: [PATCH] New: Neater filling of author images to aspect ratio --- frontend/src/Author/AuthorImage.js | 41 ++++++++++++---- .../Index/Overview/AuthorIndexOverview.css | 5 +- .../Index/Overview/AuthorIndexOverview.js | 47 +++++++++---------- .../Index/Posters/AuthorIndexPoster.css | 7 +++ .../Author/Index/Posters/AuthorIndexPoster.js | 1 + 5 files changed, 67 insertions(+), 34 deletions(-) diff --git a/frontend/src/Author/AuthorImage.js b/frontend/src/Author/AuthorImage.js index 3900deb19..adcd15e73 100644 --- a/frontend/src/Author/AuthorImage.js +++ b/frontend/src/Author/AuthorImage.js @@ -122,9 +122,17 @@ class AuthorImage extends Component { placeholder, size, lazy, - overflow + overflow, + blurBackground } = this.props; + const blurStyle = { + ...style, + objectFit: 'fill', + filter: 'blur(8px)', + WebkitFilter: 'blur(8px)' + }; + const { url, hasError, @@ -168,13 +176,26 @@ class AuthorImage extends Component { } return ( - + <> + { + blurBackground ? + : + null + } + + + ); } } @@ -188,6 +209,7 @@ AuthorImage.propTypes = { size: PropTypes.number.isRequired, lazy: PropTypes.bool.isRequired, overflow: PropTypes.bool.isRequired, + blurBackground: PropTypes.bool.isRequired, onError: PropTypes.func, onLoad: PropTypes.func }; @@ -195,7 +217,8 @@ AuthorImage.propTypes = { AuthorImage.defaultProps = { size: 250, lazy: true, - overflow: false + overflow: false, + blurBackground: false }; export default AuthorImage; diff --git a/frontend/src/Author/Index/Overview/AuthorIndexOverview.css b/frontend/src/Author/Index/Overview/AuthorIndexOverview.css index 054319ebc..f2eb3d995 100644 --- a/frontend/src/Author/Index/Overview/AuthorIndexOverview.css +++ b/frontend/src/Author/Index/Overview/AuthorIndexOverview.css @@ -14,11 +14,14 @@ $hoverScale: 1.05; } .poster { - position: relative; + position: absolute; + top: 0; + left: 0; } .posterContainer { position: relative; + overflow: hidden; } .link { diff --git a/frontend/src/Author/Index/Overview/AuthorIndexOverview.js b/frontend/src/Author/Index/Overview/AuthorIndexOverview.js index cf1e48992..95a147326 100644 --- a/frontend/src/Author/Index/Overview/AuthorIndexOverview.js +++ b/frontend/src/Author/Index/Overview/AuthorIndexOverview.js @@ -125,31 +125,30 @@ class AuthorIndexOverview extends Component { return (
-
-
- { - status === 'ended' && -
- } - - - + { + status === 'ended' && +
- -
+ } + + + +