mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-18 07:52:23 +01:00
(feat) default image for events
This commit is contained in:
parent
b9965e54e7
commit
f0d9537182
@ -6,6 +6,8 @@ import { Loader } from '../base/loader';
|
||||
import { Event } from '../../models/event';
|
||||
import FormatLib from '../../lib/format';
|
||||
|
||||
import defaultImage from '../../../../images/default-image.png';
|
||||
|
||||
declare const Application: IApplication;
|
||||
|
||||
interface EventCardProps {
|
||||
@ -60,7 +62,10 @@ export const EventCard: React.FC<EventCardProps> = ({ event, cardType }) => {
|
||||
<div className={`event-card event-card--${cardType}`}>
|
||||
{event.event_image_attributes
|
||||
? <div className="event-card-picture">
|
||||
<img src={event.event_image_attributes.attachment_url} alt={event.event_image_attributes.attachment_name} />
|
||||
<img src={event.event_image_attributes.attachment_url} alt={event.event_image_attributes.attachment_name} onError={({ currentTarget }) => {
|
||||
currentTarget.onerror = null;
|
||||
currentTarget.src = defaultImage;
|
||||
}} />
|
||||
</div>
|
||||
: cardType !== 'sm' &&
|
||||
<div className="event-card-picture">
|
||||
|
Loading…
x
Reference in New Issue
Block a user