AttachmentThumbs: click to expand post

merge-requests/692/head^2
Alex Gleason 2021-10-09 12:33:08 -05:00
rodzic 17f21c4106
commit 2608de7af4
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
3 zmienionych plików z 32 dodań i 11 usunięć

Wyświetl plik

@ -13,6 +13,7 @@ class AttachmentThumbs extends ImmutablePureComponent {
static propTypes = {
dispatch: PropTypes.func.isRequired,
media: ImmutablePropTypes.list.isRequired,
onClick: PropTypes.func,
};
renderLoading() {
@ -24,19 +25,24 @@ class AttachmentThumbs extends ImmutablePureComponent {
}
render() {
const { media } = this.props;
const { media, onClick } = this.props;
return (
<Bundle fetchComponent={MediaGallery} loading={this.renderLoading}>
{Component => (
<Component
media={media}
onOpenMedia={this.onOpenMedia}
height={50}
compact
/>
<div className='attachment-thumbs'>
<Bundle fetchComponent={MediaGallery} loading={this.renderLoading}>
{Component => (
<Component
media={media}
onOpenMedia={this.onOpenMedia}
height={50}
compact
/>
)}
</Bundle>
{onClick && (
<div className='attachment-thumbs__clickable-region' onClick={onClick} />
)}
</Bundle>
</div>
);
}

Wyświetl plik

@ -389,7 +389,7 @@ class Status extends ImmutablePureComponent {
if (size > 0) {
if (this.props.muted) {
media = (
<AttachmentThumbs media={status.get('media_attachments')} />
<AttachmentThumbs media={status.get('media_attachments')} onClick={this.handleClick} />
);
} else if (size === 1 && status.getIn(['media_attachments', 0, 'type']) === 'video') {
const video = status.getIn(['media_attachments', 0]);

Wyświetl plik

@ -714,3 +714,18 @@ a.status-card.compact:hover {
padding: 15px 0 10px;
}
}
.attachment-thumbs {
position: relative;
&__clickable-region {
cursor: pointer;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
}