aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/Attachment.js
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2021-02-12 12:37:57 +0000
committers-ol <s-ol@users.noreply.github.com>2021-02-12 12:46:51 +0000
commit947e7e5abdddee239f3984b35630750ae810e7f1 (patch)
tree91195491f5764cce61b476914554b71a6b0fc0b9 /src/ui/Attachment.js
parentfix title display (diff)
downloadfedidag-947e7e5abdddee239f3984b35630750ae810e7f1.tar.gz
fedidag-947e7e5abdddee239f3984b35630750ae810e7f1.zip
basic media attachments
Diffstat (limited to 'src/ui/Attachment.js')
-rw-r--r--src/ui/Attachment.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/ui/Attachment.js b/src/ui/Attachment.js
new file mode 100644
index 0000000..829dc8a
--- /dev/null
+++ b/src/ui/Attachment.js
@@ -0,0 +1,27 @@
+import { h } from 'preact';
+import css from './css';
+
+css`
+.attachment {
+ margin: 1rem;
+
+ width: 18rem;
+ height: 10rem;
+ object-fit: contain;
+}
+
+.attachment + .attachment {
+ margin-top: 0;
+}
+`;
+
+export const Attachment = ({ type, mediaType, url, style }) => {
+ let content;
+ if (mediaType.startsWith('video/')) {
+ content = <video class="attachment" src={url} controls />;
+ } else if (mediaType.startsWith('image/')) {
+ content = <img class="attachment" src={url} />;
+ }
+
+ return content;
+}