0
Fork 0
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:
Djordje Vlaisavljevic 2023-09-20 14:30:09 +01:00
parent cfea7a2822
commit 8f5ac0620b

View file

@ -1,13 +1,15 @@
/* eslint-disable camelcase */
import GhostLogo from '../../../../assets/images/ghost-favicon.png';
import React, {useState} from 'react';
interface Props {
title: string,
favicon?: string | null,
showSubscribes?: number | boolean,
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 clearIcon = () => {
@ -18,7 +20,14 @@ const RecommendationIcon: React.FC<Props> = ({title, favicon, featured_image}) =
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;