-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): Create new component for lightbox, don't
display thumbnail if image is a placeholder
- Loading branch information
1 parent
54aa5d3
commit bc62291
Showing
10 changed files
with
85 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
29 changes: 29 additions & 0 deletions
29
libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<gn-ui-content-ghost | ||
[showContent]="imageUrl !== undefined" | ||
ghostClass="h-36 mb-3" | ||
> | ||
<div | ||
*ngIf="imageUrl" | ||
data-cy="record-thumbnail" | ||
class="flex-shrink-0 bg-gray-100 rounded-lg overflow-hidden w-full border border-gray-300 h-36 group-hover:shadow-xl group-hover:border-0 mb-3" | ||
> | ||
<gn-ui-thumbnail | ||
class="relative h-full w-full" | ||
[thumbnailUrl]="imageUrl" | ||
fit="cover" | ||
(placeholderShown)="isPlaceholderShown.emit($event)" | ||
></gn-ui-thumbnail> | ||
<div class="relative"> | ||
<gn-ui-button | ||
class="absolute bottom-0 right-0 z-10 mr-2 mb-2" | ||
[type]="'outline'" | ||
[extraClass]="'!py-2 !px-0'" | ||
(buttonClick)="openLightbox(imageUrl)" | ||
> | ||
<mat-icon class="material-symbols-outlined font-extralight" | ||
>zoom_out_map</mat-icon | ||
> | ||
</gn-ui-button> | ||
</div> | ||
</div> | ||
</gn-ui-content-ghost> |
21 changes: 21 additions & 0 deletions
21
libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing' | ||
|
||
import { ImageOverlayPreviewComponent } from './image-overlay-preview.component' | ||
|
||
describe('ImageOverlayPreviewComponent', () => { | ||
let component: ImageOverlayPreviewComponent | ||
let fixture: ComponentFixture<ImageOverlayPreviewComponent> | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ImageOverlayPreviewComponent], | ||
}) | ||
fixture = TestBed.createComponent(ImageOverlayPreviewComponent) | ||
component = fixture.componentInstance | ||
fixture.detectChanges() | ||
}) | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy() | ||
}) | ||
}) |
15 changes: 15 additions & 0 deletions
15
libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Component, EventEmitter, Input, Output } from '@angular/core' | ||
import * as basicLightbox from 'basiclightbox' | ||
|
||
@Component({ | ||
selector: 'gn-ui-image-overlay-preview', | ||
templateUrl: './image-overlay-preview.component.html', | ||
styleUrls: ['./image-overlay-preview.component.css'], | ||
}) | ||
export class ImageOverlayPreviewComponent { | ||
@Input() imageUrl: string | ||
@Output() isPlaceholderShown = new EventEmitter<boolean>() | ||
openLightbox(src: string) { | ||
basicLightbox.create(`<img src="${src}"/>`).show() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters