snort/src/element/ProfilePreview.tsx

30 lines
866 B
TypeScript
Raw Normal View History

2023-01-01 19:57:27 +00:00
import "./ProfilePreview.css";
import ProfileImage from "./ProfileImage";
import FollowButton from "./FollowButton";
2023-01-10 10:30:33 +00:00
import useProfile from "../feed/ProfileFeed";
2023-01-16 17:48:25 +00:00
import { HexKey } from "../nostr";
2023-01-01 19:57:27 +00:00
2023-01-16 17:48:25 +00:00
export interface ProfilePreviewProps {
pubkey: HexKey,
options?: {
about?: boolean
}
}
export default function ProfilePreview(props: ProfilePreviewProps) {
2023-01-01 19:57:27 +00:00
const pubkey = props.pubkey;
2023-01-16 17:48:25 +00:00
const user = useProfile(pubkey)?.get(pubkey);
2023-01-10 10:30:33 +00:00
const options = {
about: true,
...props.options
};
2023-01-01 19:57:27 +00:00
return (
<div className="profile-preview">
2023-01-12 12:00:44 +00:00
<ProfileImage pubkey={pubkey} subHeader=
{options.about ? <div className="f-ellipsis about">
{user?.about}
2023-01-16 17:48:25 +00:00
</div> : undefined} />
2023-01-10 10:30:33 +00:00
<FollowButton pubkey={pubkey} className="ml5" />
2023-01-01 19:57:27 +00:00
</div>
)
}