Skip to content

Commit

Permalink
Fix design issues with sensitive preview cards (#14126)
Browse files Browse the repository at this point in the history
* Fix design issues with sensitive preview cards

* Center “sensitive” label on preview image for interactive cards

* Add “button” role to sensitive preview card text
  • Loading branch information
ClearlyClaire authored Jun 25, 2020
1 parent 8ed2f94 commit 1d2b0d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/javascript/mastodon/features/status/components/card.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ export default class Card extends React.PureComponent {
this.setState({ previewLoaded: true });
}

handleReveal = () => {
handleReveal = e => {
e.preventDefault();
e.stopPropagation();
this.setState({ revealed: true });
}

Expand Down Expand Up @@ -279,7 +281,7 @@ export default class Card extends React.PureComponent {
}

return (
<div className={className} ref={this.setRef}>
<div className={className} ref={this.setRef} onClick={revealed ? null : this.handleReveal} role={revealed ? 'button' : null}>
{embed}
{!compact && description}
</div>
Expand All @@ -289,14 +291,12 @@ export default class Card extends React.PureComponent {
<div className='status-card__image'>
{canvas}
{thumbnail}
{!revealed && spoilerButton}
</div>
);
} else {
embed = (
<div className='status-card__image'>
<Icon id='file-text' />
{!revealed && spoilerButton}
</div>
);
}
Expand All @@ -305,6 +305,7 @@ export default class Card extends React.PureComponent {
<a href={card.get('url')} className={className} target='_blank' rel='noopener noreferrer' ref={this.setRef}>
{embed}
{description}
{!revealed && spoilerButton}
</a>
);
}
Expand Down
1 change: 1 addition & 0 deletions app/javascript/styles/mastodon/components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3003,6 +3003,7 @@ a.account__display-name {
}

.status-card {
position: relative;
display: flex;
font-size: 14px;
border: 1px solid lighten($ui-base-color, 8%);
Expand Down

0 comments on commit 1d2b0d2

Please sign in to comment.