matrix-art

An image gallery for Matrix
git clone git://archive.git.mtrnord.blog/MTRNord/matrix-art.git
Log | Files | Refs | README | LICENSE

post.tsx (3049B)


      1 import { Suspense } from "react";
      2 import { PostData } from "../data/post";
      3 import { UserData } from "../data/user";
      4 import { SuspenseImage } from "../utils/asyncImages";
      5 import { BounceLoader } from "react-spinners";
      6 import { Link } from "react-router-dom";
      7 
      8 type Props = {
      9     user: UserData;
     10     post: PostData;
     11 };
     12 
     13 export function Post({ user, post }: Props) {
     14 
     15     return (
     16         <Suspense fallback={<div className="flex flex-col w-full"><BounceLoader color="#FEA500" /></div>}>
     17             <div className="flex flex-col">
     18                 <Link aria-label={`Open post by ${user.display_name}`} to={`/post/${post.event_id}`} className="w-full">
     19                     <SuspenseImage className="rounded-3xl shadow object-cover transition-transform ease-in-out duration-300 hover:scale-105" src={post.content.file.url} />
     20                 </Link>
     21                 <div className="flex items-center justify-between py-4">
     22                     <Link className="flex items-center" to={`/profile/${user.mxid}`}>
     23                         <img className="w-11 h-11 rounded-full mr-4 border-2 border-[#AAB3CF] hover:border-indigo-300 ease-in-out duration-150" src={user.avatar_url} />
     24                         <p className="text-data text-lg font-medium">{user.display_name}</p>
     25                     </Link>
     26                     <div className="flex text-data text-lg items-center">
     27                         <a className="mr-4 flex items-center" href="#">
     28                             <span className="mr-2 hover:fill-red-600 fill-[#AAB3CF] ease-in-out duration-150">
     29                                 <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px">
     30                                     <path d="M0 0h24v24H0V0z" fill="none" />
     31                                     <path d="M16.5 3c-1.74 0-3.41.81-4.5 2.09C10.91 3.81 9.24 3 7.5 3 4.42 3 2 5.42 2 8.5c0 3.78 3.4 6.86 8.55 11.54L12 21.35l1.45-1.32C18.6 15.36 22 12.28 22 8.5 22 5.42 19.58 3 16.5 3zm-4.4 15.55l-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05z" />
     32                                 </svg>
     33                             </span>
     34                             <span>5</span>
     35                         </a>
     36                         <a className="flex items-center" href="#">
     37                             <span className="mr-2 fill-[#AAB3CF] ease-in-out duration-150 hover:fill-orange-400">
     38                                 <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px">
     39                                     <path d="M0 0h24v24H0V0z" fill="none" />
     40                                     <path d="M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z" />
     41                                 </svg>
     42                             </span>
     43                             <span>11</span>
     44                         </a>
     45                     </div>
     46                 </div>
     47             </div>
     48         </Suspense>
     49     );
     50 }