Skip to content

Commit

Permalink
add close fullscreen button
Browse files Browse the repository at this point in the history
  • Loading branch information
bastyen committed Feb 7, 2024
1 parent ee2bd2d commit ef73a5d
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,21 @@ grw-touristic-content-detail {
width: 100%;
text-align: center;
}

.close-fullscreen-button {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
z-index: 40;
top: 16px;
right: 16px;
color: var(--swiper-navigation-color, var(--swiper-theme-color));
background-color: var(--color-primary-container);
padding: 4px;
width: 32px;
height: 32px;
border-radius: var(--border-radius, 32px);
box-shadow: var(--elevation-1);
cursor: pointer;
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ export class GrwTouristicContentDetail {
};
}

handleFullscreen() {
if (state.currentTouristicContent.attachments && state.currentTouristicContent.attachments[0] && state.currentTouristicContent.attachments[0].url) {
this.swiperImagesRef.requestFullscreen();
handleFullscreen(close: boolean = false) {
if (!close) {
if (state.currentTouristicContent.attachments && state.currentTouristicContent.attachments[0] && state.currentTouristicContent.attachments[0].url) {
this.swiperImagesRef.requestFullscreen();
}
} else {
(document as any).exitFullscreen();
}
}

Expand Down Expand Up @@ -94,6 +98,14 @@ export class GrwTouristicContentDetail {
const legend = [attachment.legend, attachment.author].filter(Boolean).join(' - ');
return (
<div class="swiper-slide">
{this.displayFullscreen && (
<div class="close-fullscreen-button" onClick={() => this.handleFullscreen(true)}>
{/* @ts-ignore */}
<span translate={false} class="material-symbols material-symbols-outlined">
close
</span>
</div>
)}
<div class="legend-container">{legend}</div>
<img
/* @ts-ignore */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,21 @@ grw-touristic-event-detail {
width: 100%;
text-align: center;
}

.close-fullscreen-button {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
z-index: 40;
top: 16px;
right: 16px;
color: var(--swiper-navigation-color, var(--swiper-theme-color));
background-color: var(--color-primary-container);
padding: 4px;
width: 32px;
height: 32px;
border-radius: var(--border-radius, 32px);
box-shadow: var(--elevation-1);
cursor: pointer;
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ export class GrwTouristicEventDetail {
};
}

handleFullscreen() {
if (state.currentTouristicEvent.attachments && state.currentTouristicEvent.attachments[0] && state.currentTouristicEvent.attachments[0].url) {
this.swiperImagesRef.requestFullscreen();
handleFullscreen(close: boolean = false) {
if (!close) {
if (state.currentTouristicEvent.attachments && state.currentTouristicEvent.attachments[0] && state.currentTouristicEvent.attachments[0].url) {
this.swiperImagesRef.requestFullscreen();
} else {
(document as any).exitFullscreen();
}
}
}

Expand Down Expand Up @@ -94,6 +98,14 @@ export class GrwTouristicEventDetail {
const legend = [attachment.legend, attachment.author].filter(Boolean).join(' - ');
return (
<div class="swiper-slide">
{this.displayFullscreen && (
<div class="close-fullscreen-button" onClick={() => this.handleFullscreen(true)}>
{/* @ts-ignore */}
<span translate={false} class="material-symbols material-symbols-outlined">
close
</span>
</div>
)}
<div class="legend-container">{legend}</div>
<img
/* @ts-ignore */
Expand Down
18 changes: 18 additions & 0 deletions src/components/grw-trek-detail/grw-trek-detail.scss
Original file line number Diff line number Diff line change
Expand Up @@ -667,3 +667,21 @@ grw-trek-detail {
width: 100%;
text-align: center;
}

.close-fullscreen-button {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
z-index: 40;
top: 16px;
right: 16px;
color: var(--swiper-navigation-color, var(--swiper-theme-color));
background-color: var(--color-primary-container);
padding: 4px;
width: 32px;
height: 32px;
border-radius: var(--border-radius, 32px);
box-shadow: var(--elevation-1);
cursor: pointer;
}
19 changes: 15 additions & 4 deletions src/components/grw-trek-detail/grw-trek-detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -507,10 +507,13 @@ export class GrwTrekDetail {
touristicEvents: { ...touristicEvents, visible: Boolean(state.trekTouristicEvents && state.trekTouristicEvents.length > 0) },
};
}

handleFullscreen() {
if (this.currentTrek.attachments && this.currentTrek.attachments[0] && this.currentTrek.attachments[0].url) {
this.swiperImagesRef.requestFullscreen();
handleFullscreen(close: boolean = false) {
if (!close) {
if (this.currentTrek.attachments && this.currentTrek.attachments[0] && this.currentTrek.attachments[0].url) {
this.swiperImagesRef.requestFullscreen();
}
} else {
(document as any).exitFullscreen();
}
}

Expand Down Expand Up @@ -686,6 +689,14 @@ export class GrwTrekDetail {
const legend = [attachment.legend, attachment.author].filter(Boolean).join(' - ');
return (
<div class="swiper-slide">
{this.displayFullscreen && (
<div class="close-fullscreen-button" onClick={() => this.handleFullscreen(true)}>
{/* @ts-ignore */}
<span translate={false} class="material-symbols material-symbols-outlined">
close
</span>
</div>
)}
<div class="legend-container">{legend}</div>
<img
/* @ts-ignore */
Expand Down

0 comments on commit ef73a5d

Please sign in to comment.