2024-09-23 03:21:46 +09:00
|
|
|
/* Significantly rewritten from upstream to keep the old design for now */
|
|
|
|
|
|
|
|
import { FormattedMessage } from 'react-intl';
|
2024-08-23 02:12:35 +09:00
|
|
|
|
|
|
|
export const ContentWarning: React.FC<{
|
|
|
|
text: string;
|
|
|
|
expanded?: boolean;
|
|
|
|
onClick?: () => void;
|
2024-09-23 03:54:11 +09:00
|
|
|
icons?: React.ReactNode[];
|
|
|
|
}> = ({ text, expanded, onClick, icons }) => (
|
2024-09-23 03:21:46 +09:00
|
|
|
<p>
|
|
|
|
<span dangerouslySetInnerHTML={{ __html: text }} className='translate' />{' '}
|
|
|
|
<button
|
|
|
|
type='button'
|
|
|
|
className='status__content__spoiler-link'
|
|
|
|
onClick={onClick}
|
|
|
|
aria-expanded={expanded}
|
|
|
|
>
|
|
|
|
{expanded ? (
|
|
|
|
<FormattedMessage id='status.show_less' defaultMessage='Show less' />
|
|
|
|
) : (
|
|
|
|
<FormattedMessage id='status.show_more' defaultMessage='Show more' />
|
|
|
|
)}
|
2024-09-23 03:54:11 +09:00
|
|
|
{icons}
|
2024-09-23 03:21:46 +09:00
|
|
|
</button>
|
|
|
|
</p>
|
2024-08-23 02:12:35 +09:00
|
|
|
);
|