import * as React from "react"; import * as Styles from "~/common/styles"; import * as Typography from "~/components/system/components/Typography"; import * as Strings from "~/common/strings"; import * as Constants from "~/common/constants"; import * as SVG from "~/common/svg"; import { ButtonPrimary, ButtonTertiary } from "~/components/system/components/Buttons"; import { css } from "@emotion/react"; import { useFollowProfileHandler } from "~/common/hooks"; const STYLES_CONTAINER = (theme) => css` width: 100%; position: relative; background-color: ${theme.semantic.bgLight}; box-shadow: 0 0 0 0.5px ${theme.semantic.bgGrayLight}, ${theme.shadow.lightSmall}; border-radius: 16px; padding: 24px 16px 16px; ${Styles.VERTICAL_CONTAINER_CENTERED} `; const STYLES_PROFILE_PREVIEW = (theme) => css` height: 120px; width: 120px; border-radius: 8px; object-fit: cover; @media (max-width: ${theme.sizes.mobile}px) { height: 104px; width: 104px; } `; export default function ProfilePreviewBlock({ onAction, viewer, profile }) { const { handleFollow, isFollowing } = useFollowProfileHandler({ onAction, viewer, user: profile, }); const isOwner = viewer?.id === profile.id; return (
{`${profile.username}`} (e.target.src = Constants.profileDefaultPicture)} />
{profile.username}
{profile.slateCount} {Strings.pluralize("collection", profile.slateCount)}
{profile?.body || "No Description"} {!isOwner && (isFollowing ? ( { e.stopPropagation(); e.preventDefault(); handleFollow(profile.id); }} full > Following ) : ( { e.stopPropagation(); e.preventDefault(); handleFollow(profile.id); }} full > Follow ))}
); }