Skip to content

Commit

Permalink
Fixed issue with offline profiles's border radius
Browse files Browse the repository at this point in the history
  • Loading branch information
nightmaregaurav committed Nov 12, 2024
1 parent 129c722 commit 8ec2ce1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nightmaregaurav/react-profile-picture",
"version": "1.0.7",
"version": "1.0.8",
"description": "Simple react profile picture component.",
"repository": {
"type": "git",
Expand Down
8 changes: 6 additions & 2 deletions src/ProfilePicture.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, {CSSProperties} from 'react';
import "./profilePicture.css";

const BORDER_WIDTH = "3px";

interface ProfilePictureProps {
size: Exclude<CSSProperties["width"], undefined>;
imageUrl: string;
Expand All @@ -23,11 +25,13 @@ const ProfilePicture = (
className={`profile-picture`}
style={{
backgroundImage: `url(${imageUrl})`,
width: `calc(${size} - 3px)`,
height: `calc(${size} - 3px)`,
width: `calc(${size} - ${BORDER_WIDTH} - ${BORDER_WIDTH})`,
height: `calc(${size} - ${BORDER_WIDTH} - ${BORDER_WIDTH})`,
borderWidth: (showOnlineBadge && isOnline) ? BORDER_WIDTH : "0px",
borderColor: (showOnlineBadge && isOnline)
? onlineBadgeColor
: "rgba(0, 0, 0, 0)",
padding: (showOnlineBadge && isOnline) ? "0px" : BORDER_WIDTH,
}}
/>
);
Expand Down
1 change: 0 additions & 1 deletion src/profilePicture.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
background-repeat: no-repeat;
background-position: center;
background-size: cover;
border-width: 3px;
border-style: solid;
}

0 comments on commit 8ec2ce1

Please # to comment.