mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-30 19:52:20 +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 { Event } from '../../models/event';
|
||||||
import FormatLib from '../../lib/format';
|
import FormatLib from '../../lib/format';
|
||||||
|
|
||||||
|
import defaultImage from '../../../../images/default-image.png';
|
||||||
|
|
||||||
declare const Application: IApplication;
|
declare const Application: IApplication;
|
||||||
|
|
||||||
interface EventCardProps {
|
interface EventCardProps {
|
||||||
@ -60,7 +62,10 @@ export const EventCard: React.FC<EventCardProps> = ({ event, cardType }) => {
|
|||||||
<div className={`event-card event-card--${cardType}`}>
|
<div className={`event-card event-card--${cardType}`}>
|
||||||
{event.event_image_attributes
|
{event.event_image_attributes
|
||||||
? <div className="event-card-picture">
|
? <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>
|
</div>
|
||||||
: cardType !== 'sm' &&
|
: cardType !== 'sm' &&
|
||||||
<div className="event-card-picture">
|
<div className="event-card-picture">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user