diff --git a/packages/app/src/Element/MediaElement.css b/packages/app/src/Element/MediaElement.css new file mode 100644 index 0000000..ec398bd --- /dev/null +++ b/packages/app/src/Element/MediaElement.css @@ -0,0 +1,14 @@ +.modal.spotlight .modal-body { + max-width: 100vw; +} + +.modal.spotlight img, +.modal.spotlight video { + max-width: 90vw; + max-height: 90vh; + aspect-ratio: unset; +} + +.modal.spotlight .close { + text-align: right; +} diff --git a/packages/app/src/Element/MediaElement.tsx b/packages/app/src/Element/MediaElement.tsx new file mode 100644 index 0000000..1511025 --- /dev/null +++ b/packages/app/src/Element/MediaElement.tsx @@ -0,0 +1,82 @@ +import { ProxyImg } from "Element/ProxyImg"; +import React, { MouseEvent, useState } from "react"; + +import "./MediaElement.css"; +import Modal from "Element/Modal"; +import Icon from "Icons/Icon"; + +/* +[ + "imeta", + "url https://nostr.build/i/148e3e8cbe29ae268b0d6aad0065a086319d3c3b1fdf8b89f1e2327d973d2d05.jpg", + "blurhash e6A0%UE2t6D*R%?u?a9G?aM|~pM|%LR*RjR-%2NG%2t7_2R*%1IVWB", + "dim 3024x4032" +], +*/ +interface MediaElementProps { + mime: string; + url: string; + magnet?: string; + sha256?: string; + blurHash?: string; +} + +export function MediaElement(props: MediaElementProps) { + if (props.mime.startsWith("image/")) { + return ( + + + + ); + } else if (props.mime.startsWith("audio/")) { + return