From c35f4bb161060c6ebd0a6e1c3f318f598eb92165 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Thu, 26 Oct 2023 02:49:03 +0800 Subject: [PATCH] Replace old media alt modal with global one --- src/components/media-modal.jsx | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/src/components/media-modal.jsx b/src/components/media-modal.jsx index 4b72e66e..3c920cc2 100644 --- a/src/components/media-modal.jsx +++ b/src/components/media-modal.jsx @@ -4,13 +4,12 @@ import { useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks'; import { useHotkeys } from 'react-hotkeys-hook'; import { oklab2rgb, rgb2oklab } from '../utils/color-utils'; +import states from '../utils/states'; import Icon from './icon'; import Link from './link'; import Media from './media'; -import MediaAltModal from './media-alt-modal'; import MenuLink from './menu-link'; -import Modal from './modal'; function MediaModal({ mediaAttachments, @@ -154,10 +153,10 @@ function MediaModal({ class="media-alt" hidden={!showControls} onClick={() => { - setShowMediaAlt({ + states.showMediaAlt = { alt: media.description, lang, - }); + }; }} > ALT @@ -289,23 +288,6 @@ function MediaModal({ )} - {!!showMediaAlt && ( - { - if (e.target === e.currentTarget) { - setShowMediaAlt(false); - carouselRef.current.focus(); - } - }} - > - setShowMediaAlt(false)} - /> - - )} ); }