diff options
author | ThibG <thib@sitedethib.com> | 2020-06-25 22:42:01 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2020-06-26 13:28:52 +0200 |
commit | 327f6309e4984e48c32535ea9db63d5f3fd1ef33 (patch) | |
tree | 2983c00aab315b6016a6e708a2e95ce110fcbb66 /app | |
parent | 9a26d2e127f7fa8bb2d245787bfc78ee0612a89b (diff) |
[Glitch] Fix design issues with sensitive preview cards
Port 1d2b0d2121550bf973e8a334cfa29c6d8749c52c to glitch-soc Signed-off-by: Thibaut Girka <thib@sitedethib.com>
Diffstat (limited to 'app')
-rw-r--r-- | app/javascript/flavours/glitch/features/status/components/card.js | 9 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/styles/components/status.scss | 1 |
2 files changed, 6 insertions, 4 deletions
diff --git a/app/javascript/flavours/glitch/features/status/components/card.js b/app/javascript/flavours/glitch/features/status/components/card.js index 03867e03a..13bc6c2b4 100644 --- a/app/javascript/flavours/glitch/features/status/components/card.js +++ b/app/javascript/flavours/glitch/features/status/components/card.js @@ -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> ); } diff --git a/app/javascript/flavours/glitch/styles/components/status.scss b/app/javascript/flavours/glitch/styles/components/status.scss index 28a4ce0ce..4d308e601 100644 --- a/app/javascript/flavours/glitch/styles/components/status.scss +++ b/app/javascript/flavours/glitch/styles/components/status.scss @@ -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%); |