diff --git a/packages/pl-fe/src/components/modal-root.tsx b/packages/pl-fe/src/components/modal-root.tsx index 4798455f4..53e8f72c6 100644 --- a/packages/pl-fe/src/components/modal-root.tsx +++ b/packages/pl-fe/src/components/modal-root.tsx @@ -217,7 +217,7 @@ const ModalRoot: React.FC = ({ children, onCancel, onClose, type, mo
{children}
diff --git a/packages/pl-fe/src/features/ui/components/modal-root.tsx b/packages/pl-fe/src/features/ui/components/modal-root.tsx index 96189e95d..c1a709b09 100644 --- a/packages/pl-fe/src/features/ui/components/modal-root.tsx +++ b/packages/pl-fe/src/features/ui/components/modal-root.tsx @@ -85,7 +85,7 @@ const ModalRoot: React.FC = () => { {(Component && !!type) && ( - + )} diff --git a/packages/pl-fe/src/modals/media-modal.tsx b/packages/pl-fe/src/modals/media-modal.tsx index 44d28ddc5..c6626c21a 100644 --- a/packages/pl-fe/src/modals/media-modal.tsx +++ b/packages/pl-fe/src/modals/media-modal.tsx @@ -12,7 +12,6 @@ import StatusActionBar from 'pl-fe/components/status-action-bar'; import HStack from 'pl-fe/components/ui/hstack'; import Icon from 'pl-fe/components/ui/icon'; import IconButton from 'pl-fe/components/ui/icon-button'; -import Stack from 'pl-fe/components/ui/stack'; import Audio from 'pl-fe/features/audio'; import PlaceholderStatus from 'pl-fe/features/placeholder/components/placeholder-status'; import Thread from 'pl-fe/features/status/components/thread'; @@ -179,7 +178,7 @@ const MediaModal: React.FC = (props) => { setZoomedIn((prev) => !prev); }, []); - const content = useMemo(() => media.map((attachment, i) => { + const content = useMemo(() => media.map((attachment, idx) => { let width: number | undefined, height: number | undefined; if (attachment.type === 'image' || attachment.type === 'gifv' || attachment.type === 'video') { width = (attachment.meta?.original?.width); @@ -195,18 +194,18 @@ const MediaModal: React.FC = (props) => { if (attachment.type === 'image') { return ( ); } else if (attachment.type === 'video') { @@ -219,7 +218,7 @@ const MediaModal: React.FC = (props) => { height={height} startTime={time} detailed - autoFocus={i === index} + autoFocus={idx === index} link={link} alt={attachment.description} key={attachment.url} @@ -293,27 +292,27 @@ const MediaModal: React.FC = (props) => { }; return ( -
+
- onClose()} > + {content} + + +
= (props) => { )} - - {/* Height based on height of top/bottom bars */} -
- {hasMultipleImages && ( -
+ {hasMultipleImages && ( + +
- )} - - onClose()} - > - {content} - - - {hasMultipleImages && ( -
+
- )} -
- - {status && ( +
+ )} + {status ? ( = (props) => { expandable /> - )} - - - {status && ( - - )} + ) : } +
+ + {status && ( + + )}
); }; diff --git a/packages/pl-fe/src/styles/components/modal.scss b/packages/pl-fe/src/styles/components/modal.scss index ed0d9a701..88cb185b0 100644 --- a/packages/pl-fe/src/styles/components/modal.scss +++ b/packages/pl-fe/src/styles/components/modal.scss @@ -1,6 +1,4 @@ -.media-modal { - touch-action: pan-y; - +.⁂-media-modal { .audio-player.detailed, .extended-video-player { @apply flex items-center justify-center; @@ -17,23 +15,4 @@ @apply max-w-full max-h-[80%]; } } - - &__closer { - display: flex; - position: absolute; - top: 0; - inset-inline-start: 0; - inset-inline-end: 0; - bottom: 0; - - > div { - flex-shrink: 0; - overflow: auto; - display: flex; - align-items: center; - justify-content: center; - width: 100%; - } - } -} - +} \ No newline at end of file diff --git a/packages/pl-fe/src/styles/new/compose.scss b/packages/pl-fe/src/styles/new/compose.scss index 3d594c99a..94176cce9 100644 --- a/packages/pl-fe/src/styles/new/compose.scss +++ b/packages/pl-fe/src/styles/new/compose.scss @@ -152,7 +152,7 @@ } } -.⁂-modal-root__modal .⁂-compose-form__select-buttons { +.⁂-modal-root__container .⁂-compose-form__select-buttons { padding-top: 0.25rem; } diff --git a/packages/pl-fe/src/styles/new/layout.scss b/packages/pl-fe/src/styles/new/layout.scss index 37180d50b..d83e044d0 100644 --- a/packages/pl-fe/src/styles/new/layout.scss +++ b/packages/pl-fe/src/styles/new/layout.scss @@ -270,25 +270,38 @@ body { @apply fixed inset-0 bg-gray-500/90 black:bg-gray-900/90 dark:bg-gray-700/90; } - &__modal { - @apply mx-auto relative pointer-events-none flex items-center; - min-height: calc(min(100vh - 3.5rem, 100dvh)); + &__container { + position: fixed; + top: 0; + inset-inline-start: 0; + width: 100%; + height: 100%; + box-sizing: border-box; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + align-content: space-around; + pointer-events: none; + user-select: none; + overscroll-behavior: none; + min-height: 100dvh; + z-index: 9999; } &[data-modal-type='DROPDOWN_MENU'] &__overlay { @apply opacity-60; } - &[data-modal-type='MEDIA'], &[data-modal-type='DROPDOWN_MENU'] { - .⁂-modal-root__modal { + &[data-modal-type='DROPDOWN_MENU'] { + .⁂-modal-root__container { margin-top: 0!important; margin-bottom: 0!important; } } - &:not([data-modal-type='MEDIA']) &__modal { + &:not([data-modal-type='MEDIA']) &__container { display: flex; - height: 100%; padding: 0 1rem; @apply md:p-0; } diff --git a/packages/pl-fe/src/styles/new/modals.scss b/packages/pl-fe/src/styles/new/modals.scss index 363a51b19..3669def3e 100644 --- a/packages/pl-fe/src/styles/new/modals.scss +++ b/packages/pl-fe/src/styles/new/modals.scss @@ -1,3 +1,5 @@ +@use 'variables'; + .⁂-crypto-donate-modal { @apply max-w-sm; } @@ -6,6 +8,72 @@ @apply max-w-4xl; } +.⁂-media-modal { + pointer-events: auto; + user-select: text; + display: flex; + max-width: 100vw; + width: 100%; + height: 100%; + position: relative; + touch-action: pan-y; + @apply bg-gray-900/90; + + &__content { + @apply flex flex-col justify-between fixed inset-0 h-full grow touch-pan-y transition-all xl:pr-96; + } + + &__closer { + display: flex; + position: absolute; + top: 0; + inset-inline-start: 0; + inset-inline-end: 0; + bottom: 0; + + @media (min-width: variables.$breakpoint-xl) { + inset-inline-end: 24rem; + } + + > div { + flex-shrink: 0; + overflow: auto; + display: flex; + align-items: center; + justify-content: center; + width: 100%; + } + } + + &__navigation { + display: flex; + flex-direction: column; + justify-content: space-between; + position: absolute; + top: 0; + inset-inline-start: 0; + inset-inline-end: 0; + bottom: 0; + pointer-events: none; + transition: opacity .3s linear; + will-change: opacity; + + &--hidden { + opacity: 0; + } + } + + &--fullscreen { + .⁂-media-modal__content { + @apply xl:pr-0; + } + + .⁂-media-modal__closer { + inset-inline-end: 0; + } + } +} + .⁂-zoomable-image { position: relative; width: 100%;