All files / app/features/connections/friends FriendSummaryView.tsx

100% Statements 9/9
50% Branches 1/2
100% Functions 2/2
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 403x 3x                   3x   24x                     24x                           24x  
import { styled } from "@mui/material";
import UserSummary from "components/UserSummary";
import { LiteUser } from "proto/api_pb";
import { BlockedUser } from "proto/blocking_pb";
 
interface FriendSummaryViewProps {
  children?: React.ReactNode;
  friend?: LiteUser.AsObject | BlockedUser.AsObject;
  isProfileLink?: boolean;
}
 
export const FRIEND_ITEM_TEST_ID = "friend-item";
 
const StyledFriendItem = styled("div")(({ theme }) => ({
  display: "flex",
  alignItems: "flex-start",
  padding: `0 ${theme.spacing(1)}`,
}));
 
function FriendSummaryView({
  children,
  friend,
  isProfileLink,
}: FriendSummaryViewProps) {
  return friend ? (
    <>
      <StyledFriendItem data-testid={FRIEND_ITEM_TEST_ID}>
        <UserSummary
          headlineComponent="h3"
          user={friend}
          isProfileLink={isProfileLink}
        />
        {children}
      </StyledFriendItem>
    </>
  ) : null;
}
 
export default FriendSummaryView;