added open external link to images
This commit is contained in:
parent
a4bcddf533
commit
ea6343355e
@ -1,4 +1,8 @@
|
||||
<div class="image">
|
||||
<a href class="image__link" (click)="openExternal()" title="open image">
|
||||
<fa-icon class="image__link--icon" [icon]="faLink"></fa-icon>
|
||||
</a>
|
||||
|
||||
<a *ngIf="attachment.type === 'image'" class="galery__image--link" title="{{ attachment.description }}"
|
||||
(click)="attachmentSelected()">
|
||||
<img class="galery__image--1" src="{{ attachment.preview_url }}" />
|
||||
|
@ -1,15 +1,41 @@
|
||||
.image {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
object-fit: cover;
|
||||
object-position: 50% 50%;
|
||||
|
||||
&__link {
|
||||
z-index: 10;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
padding: 5px 5px 8px 8px;
|
||||
transition: all .2s;
|
||||
opacity: 0;
|
||||
color: white;
|
||||
|
||||
&--icon {
|
||||
filter: drop-shadow(0 0 3px rgb(78, 78, 78));
|
||||
}
|
||||
|
||||
// &:hover {
|
||||
// color: rgb(174, 202, 255);
|
||||
// }
|
||||
}
|
||||
|
||||
&:hover &__link {
|
||||
opacity: 1;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
img, video {
|
||||
img,
|
||||
video {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
cursor: zoom-in;
|
||||
border-radius: 2px;
|
||||
border-radius: 2px;
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
||||
import { faLink } from "@fortawesome/free-solid-svg-icons";
|
||||
|
||||
import { Attachment } from '../../../../../services/models/mastodon.interfaces';
|
||||
|
||||
@ -8,6 +9,8 @@ import { Attachment } from '../../../../../services/models/mastodon.interfaces';
|
||||
styleUrls: ['./attachement-image.component.scss']
|
||||
})
|
||||
export class AttachementImageComponent implements OnInit {
|
||||
faLink = faLink;
|
||||
|
||||
@Input() attachment: Attachment;
|
||||
@Output() openEvent = new EventEmitter();
|
||||
|
||||
@ -20,4 +23,9 @@ export class AttachementImageComponent implements OnInit {
|
||||
this.openEvent.next();
|
||||
return false;
|
||||
}
|
||||
|
||||
openExternal(): boolean {
|
||||
window.open(this.attachment.url, '_blank');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user