cohost/html/this-post-is-two-posts.tsx

115 lines
2.7 KiB
TypeScript
Raw Normal View History

2023-07-21 16:56:09 -04:00
import { ComponentChildren } from "preact";
import { Main, mk_class_wrapper, render_and_copy } from "./common.tsx";
2023-07-21 16:12:55 -04:00
// i heard you liked posts, so i put a post in your post so you can post while you post
const ReblogIcon = () => (
<img
src="https://static.pyrope.net/cohost-reblog.png"
alt="the cohost reblog icon"
class="reblog"
/>
);
const LikeIcon = () => (
<img
src="https://static.pyrope.net/cohost-like.png"
alt="the cohost like icon"
class="like"
/>
);
2023-07-21 16:56:09 -04:00
const OptionsIcon = () => (
<img
src="https://static.pyrope.net/cohost-post-options.png"
alt="the cohost icon for post options"
class="options"
/>
);
2023-07-21 16:12:55 -04:00
const Bottom = ({ n_comments }: { n_comments: number }) => (
<div class="bottom">
<div class="bottom-inner">
<a
class="comments"
href="https://413.gay"
>{`${n_comments} comments`}</a>
<div class="interactions">
<ReblogIcon />
<LikeIcon />
</div>
</div>
</div>
);
2023-07-21 16:56:09 -04:00
const Content = ({
children,
id,
}: {
children?: ComponentChildren;
id?: string;
}) => (
<div class="content" id={id ? id : ""}>
{children}
</div>
);
const Middle = mk_class_wrapper("middle");
// no reblog sorry :(
const Top = ({
display_name,
username,
link,
posted,
}: {
display_name?: string;
username: string;
posted: string;
link: string;
id?: string;
}) => (
<div class="top">
<div class="top-info">
{display_name && (
<a href={`https://cohost.org/${username}`} class="display-name">
{display_name}
</a>
)}
<a href={`https://cohost.org/${username}`} class="username">
@{username}
</a>
<a href={link} class="posted">
{posted}
</a>
</div>
<OptionsIcon />
</div>
);
const Hrish = () => (
<div class="hrish">
2023-07-21 16:12:55 -04:00
<hr />
2023-07-21 16:56:09 -04:00
</div>
);
// mainly used this as my reference lol https://cohost.org/kokoscript/post/2141494-that-time-logitech-t
2023-07-21 17:07:21 -04:00
// ughhhh i should probably do tags but i'm not going to because i can
2023-07-21 16:56:09 -04:00
render_and_copy(
<>
<div id="fake-main"></div>
<Main>
<Content id="post-1">homestuck etc bla bla bla</Content>
<Hrish />
<Bottom n_comments={413} />
<Middle />
<Top
2023-07-21 17:07:21 -04:00
display_name="evil mehbark"
2023-07-21 16:56:09 -04:00
username="mehbark"
posted="42 minutes ago"
link="https://example.com"
/>
<Content id="post-2">homestuck^2 etc bla bla bla</Content>
</Main>
</>
2023-07-21 16:12:55 -04:00
);