-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(DH): Add basiclightbox for thumbnail preview #761
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7827b9e
feat(DH): Add basiclightbox for thumbnail preview
Angi-Kinas f37b140
feat(DH): Adapt styling for expand button
Angi-Kinas 63516ae
feat(DH): Fix div order
Angi-Kinas 1c8b2b7
feat(ui): Create new component for lightbox, don't
Angi-Kinas 1c5f626
feat(DH): Add e2e test for thumbnail in dataset page
Angi-Kinas 77875c2
feat(DH): Differentiate thumbnailUrl for content ghost
Angi-Kinas 1ba7227
feat(DH): Add tests for thumbnailUrl logic
Angi-Kinas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering why this is not inside
setPlaceholder()
always returningtrue
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can answer for @Angi-Kinas since we've done this together: we wanted this output to emit either
true
orfalse
according to the state of the thumbnail, and not just emittrue
when the placeholder shows up