catstodon/app/javascript/flavours/glitch/components/status_banner.tsx
Claire 1d3d549e96 [Glitch] Redesign Content Warning and filters
Port 393f0a0159 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2024-10-26 14:09:46 +02:00

42 lines
995 B
TypeScript

import { FormattedMessage } from 'react-intl';
export enum BannerVariant {
Warning = 'warning',
Filter = 'filter',
}
export const StatusBanner: React.FC<{
children: React.ReactNode;
variant: BannerVariant;
expanded?: boolean;
onClick?: () => void;
}> = ({ children, variant, expanded, onClick }) => (
<label
className={
variant === BannerVariant.Warning
? 'content-warning'
: 'content-warning content-warning--filter'
}
>
{children}
<button className='link-button' onClick={onClick}>
{expanded ? (
<FormattedMessage
id='content_warning.hide'
defaultMessage='Hide post'
/>
) : variant === BannerVariant.Warning ? (
<FormattedMessage
id='content_warning.show_more'
defaultMessage='Show more'
/>
) : (
<FormattedMessage
id='content_warning.show'
defaultMessage='Show anyway'
/>
)}
</button>
</label>
);