Carousel very buggy on mobile. Add close button.

This commit is contained in:
Lim Chee Aun 2022-12-10 22:27:00 +08:00
parent 5797b9bc38
commit 80b3432ccb
2 changed files with 29 additions and 5 deletions

View file

@ -325,16 +325,22 @@ a.hashtag {
max-height: 100vh; max-height: 100vh;
} }
.carousel-top-controls {
top: 0;
}
.carousel-controls { .carousel-controls {
bottom: 0;
}
:is(.carousel-top-controls, .carousel-controls) {
position: fixed; position: fixed;
width: 100%; width: 100%;
bottom: 0; padding: 16px;
text-align: center;
padding: 32px;
display: flex; display: flex;
gap: 8px; gap: 8px;
justify-content: space-between; justify-content: space-between;
text-align: center;
} }
button.carousel-button { button.carousel-button {
font-weight: bold; font-weight: bold;
color: var(--link-color); color: var(--link-color);
@ -460,4 +466,7 @@ button.carousel-dot.active {
.box { .box {
padding: 32px; padding: 32px;
} }
:is(.carousel-top-controls, .carousel-controls) {
padding: 32px;
}
} }

View file

@ -785,10 +785,25 @@ function Status({ statusID, status, withinContext, size = 'm', skeleton }) {
</div> </div>
{showMediaModal !== false && ( {showMediaModal !== false && (
<Modal> <Modal>
<div class="carousel-top-controls">
<span />
<button
type="button"
class="carousel-button plain"
onClick={() => setShowMediaModal(false)}
>
<Icon icon="x" />
</button>
</div>
<div <div
class="carousel" class="carousel"
onClick={() => { onClick={(e) => {
if (
e.target.classList.contains('carousel-item') ||
e.target.classList.contains('media')
) {
setShowMediaModal(false); setShowMediaModal(false);
}
}} }}
tabindex="0" tabindex="0"
> >