mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Added Ghost favicon to recommendations with 1-click subscribe
refs https://github.com/TryGhost/Product/issues/3902
This commit is contained in:
parent
cfea7a2822
commit
8f5ac0620b
1 changed files with 11 additions and 2 deletions
|
@ -1,13 +1,15 @@
|
||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
|
import GhostLogo from '../../../../assets/images/ghost-favicon.png';
|
||||||
import React, {useState} from 'react';
|
import React, {useState} from 'react';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title: string,
|
title: string,
|
||||||
favicon?: string | null,
|
favicon?: string | null,
|
||||||
|
showSubscribes?: number | boolean,
|
||||||
featured_image?: string | null
|
featured_image?: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
const RecommendationIcon: React.FC<Props> = ({title, favicon, featured_image}) => {
|
const RecommendationIcon: React.FC<Props> = ({title, favicon, showSubscribes, featured_image}) => {
|
||||||
const [icon, setIcon] = useState(favicon || featured_image || null);
|
const [icon, setIcon] = useState(favicon || featured_image || null);
|
||||||
|
|
||||||
const clearIcon = () => {
|
const clearIcon = () => {
|
||||||
|
@ -18,7 +20,14 @@ const RecommendationIcon: React.FC<Props> = ({title, favicon, featured_image}) =
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (<img alt={title} className="h-5 w-5 rounded-sm" src={icon} onError={clearIcon} />);
|
const hint = showSubscribes ? 'This is a Ghost site that supports one-click subscribe' : '';
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="relative h-5 w-5" title={hint}>
|
||||||
|
<img alt={title} className="h-5 w-5 rounded-sm" src={icon} onError={clearIcon} />
|
||||||
|
{showSubscribes && <img alt='Ghost Logo' className='absolute bottom-[-3px] right-[-3px] h-[14px] w-[14px]' src={GhostLogo} />}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default RecommendationIcon;
|
export default RecommendationIcon;
|
||||||
|
|
Loading…
Add table
Reference in a new issue