mirror of
https://github.com/Readarr/Readarr
synced 2026-05-08 12:42:51 +02:00
New: Neater filling of author images to aspect ratio
This commit is contained in:
parent
2ca55ae729
commit
aa45bc3938
5 changed files with 67 additions and 34 deletions
|
|
@ -122,9 +122,17 @@ class AuthorImage extends Component {
|
||||||
placeholder,
|
placeholder,
|
||||||
size,
|
size,
|
||||||
lazy,
|
lazy,
|
||||||
overflow
|
overflow,
|
||||||
|
blurBackground
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
const blurStyle = {
|
||||||
|
...style,
|
||||||
|
objectFit: 'fill',
|
||||||
|
filter: 'blur(8px)',
|
||||||
|
WebkitFilter: 'blur(8px)'
|
||||||
|
};
|
||||||
|
|
||||||
const {
|
const {
|
||||||
url,
|
url,
|
||||||
hasError,
|
hasError,
|
||||||
|
|
@ -168,13 +176,26 @@ class AuthorImage extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<img
|
<>
|
||||||
className={className}
|
{
|
||||||
style={style}
|
blurBackground ?
|
||||||
src={isLoaded ? url : placeholder}
|
<img
|
||||||
onError={this.onError}
|
style={blurStyle}
|
||||||
onLoad={this.onLoad}
|
src={isLoaded ? url : placeholder}
|
||||||
/>
|
onError={this.onError}
|
||||||
|
onLoad={this.onLoad}
|
||||||
|
/> :
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
|
<img
|
||||||
|
className={className}
|
||||||
|
style={style}
|
||||||
|
src={isLoaded ? url : placeholder}
|
||||||
|
onError={this.onError}
|
||||||
|
onLoad={this.onLoad}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -188,6 +209,7 @@ AuthorImage.propTypes = {
|
||||||
size: PropTypes.number.isRequired,
|
size: PropTypes.number.isRequired,
|
||||||
lazy: PropTypes.bool.isRequired,
|
lazy: PropTypes.bool.isRequired,
|
||||||
overflow: PropTypes.bool.isRequired,
|
overflow: PropTypes.bool.isRequired,
|
||||||
|
blurBackground: PropTypes.bool.isRequired,
|
||||||
onError: PropTypes.func,
|
onError: PropTypes.func,
|
||||||
onLoad: PropTypes.func
|
onLoad: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
@ -195,7 +217,8 @@ AuthorImage.propTypes = {
|
||||||
AuthorImage.defaultProps = {
|
AuthorImage.defaultProps = {
|
||||||
size: 250,
|
size: 250,
|
||||||
lazy: true,
|
lazy: true,
|
||||||
overflow: false
|
overflow: false,
|
||||||
|
blurBackground: false
|
||||||
};
|
};
|
||||||
|
|
||||||
export default AuthorImage;
|
export default AuthorImage;
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,14 @@ $hoverScale: 1.05;
|
||||||
}
|
}
|
||||||
|
|
||||||
.poster {
|
.poster {
|
||||||
position: relative;
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.posterContainer {
|
.posterContainer {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.link {
|
.link {
|
||||||
|
|
|
||||||
|
|
@ -125,31 +125,30 @@ class AuthorIndexOverview extends Component {
|
||||||
return (
|
return (
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<div className={styles.content}>
|
<div className={styles.content}>
|
||||||
<div className={styles.poster}>
|
<div className={styles.posterContainer}>
|
||||||
<div className={styles.posterContainer}>
|
{
|
||||||
{
|
status === 'ended' &&
|
||||||
status === 'ended' &&
|
<div
|
||||||
<div
|
className={styles.ended}
|
||||||
className={styles.ended}
|
title={translate('Ended')}
|
||||||
title={translate('Ended')}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
|
|
||||||
<Link
|
|
||||||
className={styles.link}
|
|
||||||
style={elementStyle}
|
|
||||||
to={link}
|
|
||||||
>
|
|
||||||
<AuthorPoster
|
|
||||||
className={styles.poster}
|
|
||||||
style={elementStyle}
|
|
||||||
images={images}
|
|
||||||
size={250}
|
|
||||||
lazy={false}
|
|
||||||
overflow={true}
|
|
||||||
/>
|
/>
|
||||||
</Link>
|
}
|
||||||
</div>
|
|
||||||
|
<Link
|
||||||
|
className={styles.link}
|
||||||
|
style={elementStyle}
|
||||||
|
to={link}
|
||||||
|
>
|
||||||
|
<AuthorPoster
|
||||||
|
className={styles.poster}
|
||||||
|
style={elementStyle}
|
||||||
|
images={images}
|
||||||
|
size={250}
|
||||||
|
lazy={false}
|
||||||
|
overflow={true}
|
||||||
|
blurBackground={true}
|
||||||
|
/>
|
||||||
|
</Link>
|
||||||
|
|
||||||
<AuthorIndexProgressBar
|
<AuthorIndexProgressBar
|
||||||
monitored={monitored}
|
monitored={monitored}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,13 @@ $hoverScale: 1.05;
|
||||||
|
|
||||||
.posterContainer {
|
.posterContainer {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.poster {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.link {
|
.link {
|
||||||
|
|
|
||||||
|
|
@ -167,6 +167,7 @@ class AuthorIndexPoster extends Component {
|
||||||
size={250}
|
size={250}
|
||||||
lazy={false}
|
lazy={false}
|
||||||
overflow={true}
|
overflow={true}
|
||||||
|
blurBackground={true}
|
||||||
onError={this.onPosterLoadError}
|
onError={this.onPosterLoadError}
|
||||||
onLoad={this.onPosterLoad}
|
onLoad={this.onPosterLoad}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue