0
0
Fork 0

Change how content warnings and filters are displayed in web UI (#31365)

This commit is contained in:
Eugen Rochko 2024-08-22 19:12:35 +02:00 committed by GitHub
parent 98237207e6
commit 500f4925a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 281 additions and 141 deletions

View file

@ -0,0 +1,37 @@
import { FormattedMessage } from 'react-intl';
export enum BannerVariant {
Yellow = 'yellow',
Blue = 'blue',
}
export const StatusBanner: React.FC<{
children: React.ReactNode;
variant: BannerVariant;
expanded?: boolean;
onClick?: () => void;
}> = ({ children, variant, expanded, onClick }) => (
<div
className={
variant === BannerVariant.Yellow
? 'content-warning'
: 'content-warning content-warning--filter'
}
>
{children}
<button className='link-button' onClick={onClick}>
{expanded ? (
<FormattedMessage
id='content_warning.hide'
defaultMessage='Hide post'
/>
) : (
<FormattedMessage
id='content_warning.show'
defaultMessage='Show anyway'
/>
)}
</button>
</div>
);