diff --git a/src/app/pages/client/space/Space.tsx b/src/app/pages/client/space/Space.tsx index 5a2ed607b..3d382c6ff 100644 --- a/src/app/pages/client/space/Space.tsx +++ b/src/app/pages/client/space/Space.tsx @@ -12,6 +12,10 @@ import { Line, Menu, MenuItem, + Modal, + Overlay, + OverlayBackdrop, + OverlayCenter, PopOut, Spinner, Text, @@ -88,6 +92,8 @@ import { nameInitials } from '$utils/common'; import { useMediaAuthentication } from '$hooks/useMediaAuthentication'; import { CustomStateEvent } from '$types/matrix/room'; import type { RoomBannerContent } from '$types/matrix-sdk-events'; +import { ModalWide } from '$styles/Modal.css'; +import { ImageViewer } from '$components/image-viewer'; import * as css from './styles.css'; import { ClientSideHoverFreeze } from '$components/ClientSideHoverFreeze'; @@ -283,6 +289,11 @@ function SpaceHeader({ hideText, mx }: { hideText?: boolean; mx: MatrixClient }) const bannerURI = mxcUrlToHttp(mx, bannerMXC ?? '', true); const hasBanner = !!(bannerURI && !hideText && showBanners); + const [bannerViewerOpen, setBannerViewerOpen] = useState(false); + useEffect(() => { + if (!hasBanner) setBannerViewerOpen(false); + }, [hasBanner]); + return ( <>
@@ -368,6 +379,16 @@ function SpaceHeader({ hideText, mx }: { hideText?: boolean; mx: MatrixClient }) src={bannerURI} alt={`${spaceName}'s banner`} draggable="false" + role="button" + tabIndex={0} + aria-label={`View ${spaceName} banner`} + onClick={() => setBannerViewerOpen(true)} + onKeyDown={(e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + setBannerViewerOpen(true); + } + }} /> )} + {hasBanner && bannerViewerOpen && ( + }> + + setBannerViewerOpen(false), + clickOutsideDeactivates: true, + escapeDeactivates: stopPropagation, + }} + > + evt.stopPropagation()} + > + setBannerViewerOpen(false)} + /> + + + + + )} ); }