cohost/html/one-post.tsx

71 lines
1.6 KiB
TypeScript
Raw Normal View History

2023-09-30 15:18:38 -04:00
import { ComponentChildren } from "preact";
import { render_and_copy } from "./common.tsx";
import { Top, Bottom, Hrish } from "./this-post-is-two-posts.tsx";
// this would be a funny time to do multiple posts
export const Post = ({
children,
headline,
n_comments,
display_name,
username,
posted,
2023-09-30 15:44:05 -04:00
link,
2023-09-30 15:18:38 -04:00
id,
alt_text = true,
2023-09-30 15:18:38 -04:00
}: {
children?: ComponentChildren;
headline?: string;
n_comments: number;
display_name?: string;
username: string;
posted: string;
2023-09-30 15:30:55 -04:00
link?: string;
2023-09-30 15:18:38 -04:00
id?: string;
alt_text?: boolean;
2023-09-30 15:18:38 -04:00
}) => (
<div class="post">
<Top
display_name={display_name}
username={username}
posted={posted}
link={link}
id={id}
alt_text={alt_text}
2023-09-30 15:18:38 -04:00
/>
<Hrish />
<div class="post-inner">
{headline && (
<div class="headline">
<a href={link}>
<h1>{headline}</h1>
</a>
</div>
)}
2023-09-30 15:30:55 -04:00
<div style="display: flex;">
<div class="post-content">{children}</div>
</div>
2023-09-30 15:18:38 -04:00
</div>
<Hrish />
<Bottom n_comments={n_comments} alt_text={alt_text} />
2023-09-30 15:18:38 -04:00
</div>
);
render_and_copy(
2023-09-30 15:30:55 -04:00
<div class="posts">
<Post
headline="can i have more than one post please"
username="mehbark"
posted="6 hr. ago"
n_comments={2}
alt_text={false}
2023-09-30 15:30:55 -04:00
>
one post isn't really enough for me
</Post>
</div>
2023-09-30 15:18:38 -04:00
);