You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
821 B
37 lines
821 B
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> |
|
);
|
|
|