Skip to content

Commit

Permalink
T267291 Add visual indicator to show more images inside gallery (#285)
Browse files Browse the repository at this point in the history
* temp for arrow button in gallery

* replace with arrow svg

* arrow direction based on the content language
  • Loading branch information
hueitan authored Nov 27, 2020
1 parent 6bf5e05 commit 21bf39f
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
31 changes: 31 additions & 0 deletions images/arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/components/Gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ export const Gallery = ({ close, closeAll, items, startFileName, lang, dir }) =>
</div>
)
}
{
currentIndex !== 0 && (
<div class={`arrow ${dir === 'rtl' ? 'right' : 'left'}`} />
)
}
{
currentIndex < items.length - 1 && (
<div class={`arrow ${dir === 'rtl' ? 'left' : 'right'}`} />
)
}
<div class='img'>
<img onLoad={onImageLoad} src={items[currentIndex].thumbnail} />
</div>
Expand Down
21 changes: 21 additions & 0 deletions style/gallery.less
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@
}
}

.arrow {
position: absolute;
top: calc( 50% - 10px );
width: 28px;
height: 28px;
background-image: url( /images/arrow.svg );

&.left {
left: 8px;
transform: scaleX( -1 );
}

&.right {
right: 8px;
}
}

&.portrait {
.img {
height: @availableHeight; // Required under portrait for black background to work on device
Expand All @@ -51,6 +68,10 @@
.img {
height: calc( 100vh - @softkeysHeight - 27px );
}

.arrow {
top: calc( 50% - 10px + @softkeysHeight/2 );
}
}
}

Expand Down

0 comments on commit 21bf39f

Please sign in to comment.