Skip to content

Commit

Permalink
fix(Avatar): show initials if src is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptammergard committed Nov 22, 2023
1 parent ce09f21 commit 237206e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/pink-readers-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@einride/ui": patch
---

Show initials in avatar if src is undefined.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const Avatar = forwardRef<HTMLImageElement, AvatarProps>(
({ background = "primary", color = "primary", radius = "full", size = "md", ...props }, ref) => {
const [hasError, setHasError] = useState(false)

if ("src" in props) {
if ("src" in props && typeof props.src === "string") {
const { name, src, ...rest } = props

if (hasError) {
Expand Down

0 comments on commit 237206e

Please sign in to comment.