[Glitch] Fix design issues with sensitive preview cards

Port 1d2b0d2121 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
This commit is contained in:
ThibG 2020-06-25 22:42:01 +02:00 committed by Thibaut Girka
parent 9a26d2e127
commit 327f6309e4
2 changed files with 6 additions and 4 deletions

View File

@ -156,7 +156,9 @@ export default class Card extends React.PureComponent {
this.setState({ previewLoaded: true });
}
handleReveal = () => {
handleReveal = e => {
e.preventDefault();
e.stopPropagation();
this.setState({ revealed: true });
}
@ -244,7 +246,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>
@ -254,14 +256,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>
);
}
@ -270,6 +270,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>
);
}

View File

@ -776,6 +776,7 @@ a.status__display-name,
}
.status-card {
position: relative;
display: flex;
font-size: 14px;
border: 1px solid lighten($ui-base-color, 8%);