Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Content Warning design to match upstream's #2890

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 9 additions & 25 deletions app/javascript/flavours/glitch/components/content_warning.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,17 @@
/* Significantly rewritten from upstream to keep the old design for now */

import { FormattedMessage } from 'react-intl';
import { StatusBanner, BannerVariant } from './status_banner';

export const ContentWarning: React.FC<{
text: string;
expanded?: boolean;
onClick?: () => void;
icons?: React.ReactNode[];
}> = ({ text, expanded, onClick, icons }) => (
<p>
<span dangerouslySetInnerHTML={{ __html: text }} className='translate' />{' '}
<button
type='button'
className='status__content__spoiler-link'
onClick={onClick}
aria-expanded={expanded}
>
{expanded ? (
<FormattedMessage
id='content_warning.hide'
defaultMessage='Hide post'
/>
) : (
<FormattedMessage
id='content_warning.show_more'
defaultMessage='Show more'
/>
)}
{icons}
</button>
</p>
<StatusBanner
expanded={expanded}
onClick={onClick}
variant={BannerVariant.Warning}
>
{icons}
<p dangerouslySetInnerHTML={{ __html: text }} />
</StatusBanner>
);
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ class StatusContent extends PureComponent {
)).reduce((aggregate, item) => [...aggregate, item, ' '], []);

let spoilerIcons = [];
if (hidden && mediaIcons) {
if (mediaIcons) {
const mediaComponents = {
'link': LinkIcon,
'picture-o': ImageIcon,
Expand Down
27 changes: 8 additions & 19 deletions app/javascript/flavours/glitch/styles/components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1399,9 +1399,9 @@ body > [data-popper-placement] {
}

.status__content__spoiler-link {
display: inline-flex; // glitch: media icon in spoiler button
display: inline-block;
border-radius: 2px;
background: $action-button-color; // glitch: design used in more places
background: transparent;
border: 0;
color: $inverted-text-color;
font-weight: 700;
Expand All @@ -1411,23 +1411,6 @@ body > [data-popper-placement] {
line-height: 20px;
cursor: pointer;
vertical-align: top;
align-items: center; // glitch: content indicator

&:hover {
// glitch: design used in more places
background: lighten($action-button-color, 7%);
text-decoration: none;
}

.status__content__spoiler-icon {
display: inline-block;
margin-inline-start: 5px;
border-inline-start: 1px solid currentColor;
padding: 0;
padding-inline-start: 4px;
width: 16px;
height: 16px;
}
}

.status__wrapper--filtered {
Expand Down Expand Up @@ -11683,4 +11666,10 @@ noscript {
color: $secondary-text-color;
}
}

.status__content__spoiler-icon {
float: inline-end;
width: 20px;
height: 20px;
}
}
Loading