Skip to content

Commit

Permalink
Updated Variable Names
Browse files Browse the repository at this point in the history
  • Loading branch information
shivankacker authored Oct 17, 2024
1 parent 792f6c0 commit 0681607
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/Components/Common/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,18 @@ const Avatar: React.FC<AvatarProps> = ({
className,
}) => {
const [bgColor] = propColors || toColor(name);
const [w, setW] = useState(0);
const [width, setWidth] = useState(0);
const avatarRef = useRef<HTMLDivElement>(null);

useEffect(() => {
const updateW = () => {
const updateWidth = () => {
const avatarRect = avatarRef.current?.getBoundingClientRect();
const w = avatarRect?.width || 0;
setW(w);
const width = avatarRect?.width || 0;
setWidth(width);
};
updateW();
document.addEventListener("resize", updateW);
return () => document.removeEventListener("resize", updateW);
updateWidth();
document.addEventListener("resize", updateWidth);
return () => document.removeEventListener("resize", updateWidth);
}, []);

return (
Expand All @@ -79,8 +79,8 @@ const Avatar: React.FC<AvatarProps> = ({
)}
style={{
background: bgColor,
borderRadius: w / 15 + "px",
fontSize: w / 2.5 + "px",
borderRadius: width / 15 + "px",
fontSize: width / 2.5 + "px",
}}
>
{imageUrl ? (
Expand Down

0 comments on commit 0681607

Please sign in to comment.