mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-22 20:31:13 +00:00
Some icon / banner fixes.
- Adding a max icon / banner size. Fixes #88 - Using rem image height and width. Fixes #87
This commit is contained in:
parent
1287b67d1f
commit
f6ad4c33b5
2 changed files with 9 additions and 4 deletions
|
@ -19,7 +19,6 @@ export class BannerIconHeader extends Component<BannerIconHeaderProps, any> {
|
||||||
<PictrsImage
|
<PictrsImage
|
||||||
src={this.props.icon}
|
src={this.props.icon}
|
||||||
iconOverlay
|
iconOverlay
|
||||||
noFluid
|
|
||||||
pushup={!!this.props.banner}
|
pushup={!!this.props.banner}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { Component } from 'inferno';
|
||||||
|
|
||||||
const iconThumbnailSize = 96;
|
const iconThumbnailSize = 96;
|
||||||
const thumbnailSize = 256;
|
const thumbnailSize = 256;
|
||||||
|
const maxImageSize = 1000;
|
||||||
|
|
||||||
interface PictrsImageProps {
|
interface PictrsImageProps {
|
||||||
src: string;
|
src: string;
|
||||||
|
@ -10,7 +11,6 @@ interface PictrsImageProps {
|
||||||
nsfw?: boolean;
|
nsfw?: boolean;
|
||||||
iconOverlay?: boolean;
|
iconOverlay?: boolean;
|
||||||
pushup?: boolean;
|
pushup?: boolean;
|
||||||
noFluid?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PictrsImage extends Component<PictrsImageProps, any> {
|
export class PictrsImage extends Component<PictrsImageProps, any> {
|
||||||
|
@ -26,8 +26,12 @@ export class PictrsImage extends Component<PictrsImageProps, any> {
|
||||||
<img
|
<img
|
||||||
src={this.src('jpg')}
|
src={this.src('jpg')}
|
||||||
className={`
|
className={`
|
||||||
${!this.props.noFluid && 'img-fluid '}
|
${!this.props.icon && !this.props.iconOverlay && 'img-fluid '}
|
||||||
${this.props.thumbnail ? 'thumbnail rounded ' : 'img-expanded '}
|
${
|
||||||
|
this.props.thumbnail && !this.props.icon
|
||||||
|
? 'thumbnail rounded '
|
||||||
|
: 'img-expanded '
|
||||||
|
}
|
||||||
${this.props.thumbnail && this.props.nsfw && 'img-blur '}
|
${this.props.thumbnail && this.props.nsfw && 'img-blur '}
|
||||||
${this.props.icon && 'rounded-circle img-icon mr-2 '}
|
${this.props.icon && 'rounded-circle img-icon mr-2 '}
|
||||||
${this.props.iconOverlay && 'ml-2 mb-0 rounded-circle avatar-overlay '}
|
${this.props.iconOverlay && 'ml-2 mb-0 rounded-circle avatar-overlay '}
|
||||||
|
@ -58,6 +62,8 @@ export class PictrsImage extends Component<PictrsImageProps, any> {
|
||||||
params['thumbnail'] = thumbnailSize;
|
params['thumbnail'] = thumbnailSize;
|
||||||
} else if (this.props.icon) {
|
} else if (this.props.icon) {
|
||||||
params['thumbnail'] = iconThumbnailSize;
|
params['thumbnail'] = iconThumbnailSize;
|
||||||
|
} else {
|
||||||
|
params['thumbnail'] = maxImageSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
let paramsStr = `?${new URLSearchParams(params).toString()}`;
|
let paramsStr = `?${new URLSearchParams(params).toString()}`;
|
||||||
|
|
Loading…
Reference in a new issue