mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-25 09:18:51 +01:00
Replace old media alt modal with global one
This commit is contained in:
parent
8426a011b0
commit
c35f4bb161
1 changed files with 3 additions and 21 deletions
|
@ -4,13 +4,12 @@ import { useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks';
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
|
|
||||||
import { oklab2rgb, rgb2oklab } from '../utils/color-utils';
|
import { oklab2rgb, rgb2oklab } from '../utils/color-utils';
|
||||||
|
import states from '../utils/states';
|
||||||
|
|
||||||
import Icon from './icon';
|
import Icon from './icon';
|
||||||
import Link from './link';
|
import Link from './link';
|
||||||
import Media from './media';
|
import Media from './media';
|
||||||
import MediaAltModal from './media-alt-modal';
|
|
||||||
import MenuLink from './menu-link';
|
import MenuLink from './menu-link';
|
||||||
import Modal from './modal';
|
|
||||||
|
|
||||||
function MediaModal({
|
function MediaModal({
|
||||||
mediaAttachments,
|
mediaAttachments,
|
||||||
|
@ -154,10 +153,10 @@ function MediaModal({
|
||||||
class="media-alt"
|
class="media-alt"
|
||||||
hidden={!showControls}
|
hidden={!showControls}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setShowMediaAlt({
|
states.showMediaAlt = {
|
||||||
alt: media.description,
|
alt: media.description,
|
||||||
lang,
|
lang,
|
||||||
});
|
};
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span class="alt-badge">ALT</span>
|
<span class="alt-badge">ALT</span>
|
||||||
|
@ -289,23 +288,6 @@ function MediaModal({
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue