forked from glitch-soc/mastodon
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change how content warnings and filters are displayed in web UI (mast…
- Loading branch information
Showing
11 changed files
with
281 additions
and
141 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { StatusBanner, BannerVariant } from './status_banner'; | ||
|
||
export const ContentWarning: React.FC<{ | ||
text: string; | ||
expanded?: boolean; | ||
onClick?: () => void; | ||
}> = ({ text, expanded, onClick }) => ( | ||
<StatusBanner | ||
expanded={expanded} | ||
onClick={onClick} | ||
variant={BannerVariant.Yellow} | ||
> | ||
<p dangerouslySetInnerHTML={{ __html: text }} /> | ||
</StatusBanner> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { FormattedMessage } from 'react-intl'; | ||
|
||
import { StatusBanner, BannerVariant } from './status_banner'; | ||
|
||
export const FilterWarning: React.FC<{ | ||
title: string; | ||
expanded?: boolean; | ||
onClick?: () => void; | ||
}> = ({ title, expanded, onClick }) => ( | ||
<StatusBanner | ||
expanded={expanded} | ||
onClick={onClick} | ||
variant={BannerVariant.Blue} | ||
> | ||
<p> | ||
<FormattedMessage | ||
id='filter_warning.matches_filter' | ||
defaultMessage='Matches filter “{title}”' | ||
values={{ title }} | ||
/> | ||
</p> | ||
</StatusBanner> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.