Removing X image placeholder in favor of contextual icons

This commit is contained in:
James Barnsley
2020-04-16 20:43:02 +12:00
parent e4267256af
commit 0021883913
11 changed files with 85 additions and 27 deletions

View File

@ -4308,6 +4308,15 @@ select {
perspective: 100px; perspective: 100px;
width: 100%; width: 100%;
max-width: 300px; } max-width: 300px; }
.thumbnail__placeholder.icon {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-0.5em, -0.5em);
opacity: 0.15;
font-size: 3rem;
line-height: 1em;
width: 1em; }
.thumbnail__image { .thumbnail__image {
-webkit-transition: all 0.1s ease-in-out; -webkit-transition: all 0.1s ease-in-out;
-moz-transition: all 0.1s ease-in-out; -moz-transition: all 0.1s ease-in-out;

File diff suppressed because one or more lines are too long

View File

@ -66878,7 +66878,8 @@ var GridItem = function (_React$Component) {
glow: true, glow: true,
size: 'medium', size: 'medium',
className: 'grid__item__thumbnail', className: 'grid__item__thumbnail',
images: item.images || item.icons images: item.images || item.icons,
type: type
}), }),
_react2.default.createElement( _react2.default.createElement(
'div', 'div',
@ -71646,10 +71647,35 @@ exports.default = (0, _react.memo)(function (props) {
); );
} }
var placeholderIcon = function placeholderIcon() {
switch (props.type) {
case 'artist':
case 'user':
return 'person';
case 'album':
return 'album';
case 'playlist':
return 'queue_music';
case 'track':
return 'audio_track';
default:
return 'image';
};
};
var placeholder = 'image';
return _react2.default.createElement( return _react2.default.createElement(
'div', 'div',
{ className: class_name }, { className: class_name },
props.useImageTag ? _react2.default.createElement('img', { alt: 'Artwork thumbnail', className: 'thumbnail__image thumbnail__image--use-image-tag', src: '' + (image || '/iris/assets/no-image.svg') }) : _react2.default.createElement('div', { className: 'thumbnail__image', style: { backgroundImage: 'url("' + (image || '/iris/assets/no-image.svg') + '")' } }), !image && _react2.default.createElement(_Icon2.default, { className: 'thumbnail__placeholder', name: placeholderIcon() }),
props.useImageTag && image ? _react2.default.createElement('img', {
alt: 'Artwork thumbnail',
className: 'thumbnail__image thumbnail__image--use-image-tag',
src: image
}) : _react2.default.createElement('div', {
className: 'thumbnail__image',
style: { backgroundImage: 'url("' + image + '")' }
}),
props.glow && image && _react2.default.createElement('div', { className: 'thumbnail__image thumbnail__image--glow', style: { backgroundImage: 'url("' + image + '")' } }), props.glow && image && _react2.default.createElement('div', { className: 'thumbnail__image thumbnail__image--glow', style: { backgroundImage: 'url("' + image + '")' } }),
_react2.default.createElement( _react2.default.createElement(
'div', 'div',
@ -88611,7 +88637,7 @@ var Artist = function (_React$Component) {
_react2.default.createElement( _react2.default.createElement(
'div', 'div',
{ className: 'heading__thumbnail' }, { className: 'heading__thumbnail' },
_react2.default.createElement(_Thumbnail2.default, { size: 'medium', circle: true, canZoom: true, image: image }) _react2.default.createElement(_Thumbnail2.default, { size: 'medium', circle: true, canZoom: true, type: 'artist', image: image })
), ),
_react2.default.createElement( _react2.default.createElement(
'div', 'div',

File diff suppressed because one or more lines are too long

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve">
<line fill="none" stroke="#777777" stroke-width="0.1417" stroke-miterlimit="10" x1="4.167" y1="4.167" x2="27.833" y2="27.833" opacity="0.3" />
<line fill="none" stroke="#777777" stroke-width="0.1417" stroke-miterlimit="10" x1="4.167" y1="27.833" x2="27.833" y2="4.167" opacity="0.3" />
</svg>

Before

Width:  |  Height:  |  Size: 765 B

View File

@ -100,7 +100,7 @@
// Release details // Release details
// These are automatically injected to built HTML // These are automatically injected to built HTML
var build = "1587010996"; var build = "1587020100";
var version = "3.46.0"; var version = "3.46.0";
// Construct the script tag // Construct the script tag

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve">
<line fill="none" stroke="#777777" stroke-width="0.1417" stroke-miterlimit="10" x1="4.167" y1="4.167" x2="27.833" y2="27.833" opacity="0.3" />
<line fill="none" stroke="#777777" stroke-width="0.1417" stroke-miterlimit="10" x1="4.167" y1="27.833" x2="27.833" y2="4.167" opacity="0.3" />
</svg>

Before

Width:  |  Height:  |  Size: 765 B

View File

@ -118,6 +118,7 @@ export default class GridItem extends React.Component {
size="medium" size="medium"
className="grid__item__thumbnail" className="grid__item__thumbnail"
images={item.images || item.icons} images={item.images || item.icons}
type={type}
/> />
<div className="grid__item__name"> <div className="grid__item__name">
{item.name ? item.name : <span className="opaque-text">{item.uri}</span>} {item.name ? item.name : <span className="opaque-text">{item.uri}</span>}

View File

@ -52,12 +52,39 @@ export default memo((props) => {
zoom_icon = <Link className="thumbnail__zoom" to={`/image-zoom?url=${image}`}><Icon name="search" /></Link>; zoom_icon = <Link className="thumbnail__zoom" to={`/image-zoom?url=${image}`}><Icon name="search" /></Link>;
} }
const placeholderIcon = () => {
switch (props.type) {
case 'artist':
case 'user':
return 'person';
case 'album':
return 'album';
case 'playlist':
return 'queue_music';
case 'track':
return 'audio_track';
default:
return 'image';
};
}
let placeholder = 'image';
return ( return (
<div className={class_name}> <div className={class_name}>
{props.useImageTag ? ( {!image && (
<img alt="Artwork thumbnail" className="thumbnail__image thumbnail__image--use-image-tag" src={`${image || '/iris/assets/no-image.svg'}`} /> <Icon className="thumbnail__placeholder" name={placeholderIcon()} />
)}
{props.useImageTag && image ? (
<img
alt="Artwork thumbnail"
className="thumbnail__image thumbnail__image--use-image-tag"
src={image}
/>
) : ( ) : (
<div className="thumbnail__image" style={{ backgroundImage: `url("${image || '/iris/assets/no-image.svg'}")` }} /> <div
className="thumbnail__image"
style={{ backgroundImage: `url("${image}")` }}
/>
)} )}
{props.glow && image && <div className="thumbnail__image thumbnail__image--glow" style={{ backgroundImage: `url("${image}")` }} />} {props.glow && image && <div className="thumbnail__image thumbnail__image--glow" style={{ backgroundImage: `url("${image}")` }} />}
<div className="thumbnail__actions"> <div className="thumbnail__actions">

View File

@ -52,7 +52,7 @@ class Artist extends React.Component {
loadArtist, loadArtist,
}, },
} = this.props; } = this.props;
if (uri !== prevUri) { if (uri !== prevUri) {
loadArtist(uri); loadArtist(uri);
} else if (!prev_mopidy_connected && mopidy_connected) { } else if (!prev_mopidy_connected && mopidy_connected) {
@ -407,7 +407,7 @@ class Artist extends React.Component {
<div className="heading"> <div className="heading">
<div className="heading__thumbnail"> <div className="heading__thumbnail">
<Thumbnail size="medium" circle canZoom image={image} /> <Thumbnail size="medium" circle canZoom type="artist" image={image} />
</div> </div>
<div className="heading__content"> <div className="heading__content">

View File

@ -7,6 +7,17 @@
width: 100%; width: 100%;
max-width: 300px; max-width: 300px;
&__placeholder.icon {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-0.5em, -0.5em);
opacity: 0.15;
font-size: 3rem;
line-height: 1em;
width: 1em;
}
&__image { &__image {
@include animate(0.1s); @include animate(0.1s);
position: relative; position: relative;