2022-12-04 04:55:20 -05:00
|
|
|
import CreatedAgoBadge from "@components/badges/created-ago-badge"
|
|
|
|
import ExpirationBadge from "@components/badges/expiration-badge"
|
|
|
|
import VisibilityBadge from "@components/badges/visibility-badge"
|
|
|
|
import Link from "@components/link"
|
|
|
|
import Skeleton from "@components/skeleton"
|
|
|
|
import styles from "./title.module.css"
|
2022-12-04 04:31:51 -05:00
|
|
|
|
|
|
|
type TitleProps = {
|
|
|
|
title: string
|
|
|
|
loading?: boolean
|
|
|
|
displayName?: string
|
|
|
|
visibility?: string
|
2022-12-04 17:26:05 -05:00
|
|
|
createdAt?: string
|
|
|
|
expiresAt?: string
|
2022-12-04 04:55:20 -05:00
|
|
|
authorId?: string
|
2022-12-04 04:31:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
export const PostTitle = ({
|
2022-12-04 04:55:20 -05:00
|
|
|
title,
|
|
|
|
displayName,
|
|
|
|
visibility,
|
|
|
|
createdAt,
|
|
|
|
expiresAt,
|
|
|
|
loading,
|
|
|
|
authorId
|
2022-12-04 04:31:51 -05:00
|
|
|
}: TitleProps) => {
|
|
|
|
return (
|
|
|
|
<span className={styles.title}>
|
|
|
|
<h3>
|
|
|
|
{title}{" "}
|
|
|
|
<span style={{ color: "var(--gray)" }}>
|
2022-12-04 04:55:20 -05:00
|
|
|
by{" "}
|
|
|
|
<Link href={`/author/${authorId}`}>{displayName || "anonymous"}</Link>
|
2022-12-04 04:31:51 -05:00
|
|
|
</span>
|
|
|
|
</h3>
|
|
|
|
{!loading && (
|
|
|
|
<span className={styles.badges}>
|
|
|
|
{visibility && <VisibilityBadge visibility={visibility} />}
|
|
|
|
{createdAt && <CreatedAgoBadge createdAt={createdAt} />}
|
|
|
|
{expiresAt && <ExpirationBadge postExpirationDate={expiresAt} />}
|
|
|
|
</span>
|
|
|
|
)}
|
|
|
|
{loading && (
|
|
|
|
<span className={styles.badges}>
|
|
|
|
<Skeleton width={100} height={20} />
|
|
|
|
<Skeleton width={100} height={20} />
|
|
|
|
<Skeleton width={100} height={20} />
|
|
|
|
</span>
|
|
|
|
)}
|
|
|
|
</span>
|
|
|
|
)
|
|
|
|
}
|