import clsx from 'clsx'; import React, { useState } from 'react'; import { defineMessages, useIntl } from 'react-intl'; import { Icon } from 'soapbox/components/ui'; import type { Group } from 'soapbox/schemas'; const messages = defineMessages({ header: { id: 'group.header.alt', defaultMessage: 'Group header' }, }); interface IGroupHeaderImage { group?: Group | false | null className?: string } const GroupHeaderImage: React.FC = ({ className, group }) => { const intl = useIntl(); const [isHeaderMissing, setIsHeaderMissing] = useState(false); if (!group || !group.header) { return null; } if (isHeaderMissing) { return (
); } return ( {intl.formatMessage(messages.header)} setIsHeaderMissing(true)} /> ); }; export default GroupHeaderImage;