diff options
| author | 2023-04-22 19:52:26 +0800 | |
|---|---|---|
| committer | 2023-04-22 19:52:26 +0800 | |
| commit | 4838df315931bb883f704ec3e1abe2685f296cdf (patch) | |
| tree | 57a8550c4cd5338f1126364bb518c6cde8d96e7d /docs/components/Tweet.tsx | |
| parent | db74ade0234a40c2120ad5f2a41bee50ce13de02 (diff) | |
| download | HydroRoll-4838df315931bb883f704ec3e1abe2685f296cdf.tar.gz HydroRoll-4838df315931bb883f704ec3e1abe2685f296cdf.zip | |
😀
Diffstat (limited to 'docs/components/Tweet.tsx')
| -rw-r--r-- | docs/components/Tweet.tsx | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/docs/components/Tweet.tsx b/docs/components/Tweet.tsx new file mode 100644 index 0000000..e5ac388 --- /dev/null +++ b/docs/components/Tweet.tsx @@ -0,0 +1,46 @@ +import Image from "next/image"; + +function TweetLink({ href, children }) { + return ( + <a + href={href} + target="_blank" + rel="noopener noreferrer" + className="inline-block text-[#35ACDF]" + > + {children} + </a> + ); +} + +export function Mention({ children }) { + return ( + <TweetLink href={`https://twitter.com/${children.replace("@", "")}`}> + {children} + </TweetLink> + ); +} + +export default function Tweet({ url, username, name, avatar, date, children }) { + return ( + <div className="flex p-4 bg-white rounded-md shadow-xl dark:bg-opacity-10"> + <div className="flex-shrink-0 mr-4"> + <Image + className="w-12 h-12 rounded-full" + width={42} + height={42} + src={avatar} + alt={`${name} twitter avatar`} + /> + </div> + <div> + <div className="flex items-center space-x-1 text-sm"> + <h4 className="font-medium dark:text-white">{name}</h4> + <div className="truncate dark:text-gray-400">@{username}</div> + <div className="dark:text-gray-500 md:hidden xl:block">• {date}</div> + </div> + <div className="mt-1 text-sm dark:text-gray-200">{children}</div> + </div> + </div> + ); +} |
