diff options
author | polwex <polwex@sortug.com> | 2025-09-17 15:56:00 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2025-09-17 15:56:00 +0700 |
commit | f0df4c7297a05bd592d8717b8997284c80fd0500 (patch) | |
tree | 2d38e079e971a2e98e78a0f7a3104f2bd3c5daeb /front/src/components/post/Media.tsx | |
parent | 387af8fc1603805b02ce03f8adba4fa73a954f7c (diff) |
argh
Diffstat (limited to 'front/src/components/post/Media.tsx')
-rw-r--r-- | front/src/components/post/Media.tsx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/front/src/components/post/Media.tsx b/front/src/components/post/Media.tsx new file mode 100644 index 0000000..04ea156 --- /dev/null +++ b/front/src/components/post/Media.tsx @@ -0,0 +1,35 @@ +import type { Media } from "@/types/trill"; +interface Props { + media: Media[]; +} +function M({ media }: Props) { + return ( + <div className="body-media"> + {media.map((m, i) => { + return "video" in m.media ? ( + <video key={JSON.stringify(m) + i} src={m.media.video} controls /> + ) : "audio" in m.media ? ( + <audio key={JSON.stringify(m) + i} src={m.media.audio} controls /> + ) : "images" in m.media ? ( + <Images key={JSON.stringify(m) + i} urls={m.media.images} /> + ) : null; + })} + </div> + ); +} +export default M; + +function Images({ urls }: { urls: string[] }) { + return ( + <> + {urls.map((u, i) => ( + <img + key={u + i} + className={`body-img body-img-1-of-${urls.length}`} + src={u} + alt="" + /> + ))} + </> + ); +} |