Replace old media alt modal with global one

This commit is contained in:
Lim Chee Aun 2023-10-26 02:49:03 +08:00
parent 8426a011b0
commit c35f4bb161

View file

@ -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,
});
};
}}
>
<span class="alt-badge">ALT</span>
@ -289,23 +288,6 @@ function MediaModal({
</button>
</div>
)}
{!!showMediaAlt && (
<Modal
class="light"
onClick={(e) => {
if (e.target === e.currentTarget) {
setShowMediaAlt(false);
carouselRef.current.focus();
}
}}
>
<MediaAltModal
alt={showMediaAlt.alt || showMediaAlt}
lang={showMediaAlt?.lang}
onClose={() => setShowMediaAlt(false)}
/>
</Modal>
)}
</div>
);
}