Skip to content

Commit

Permalink
Trim Avatar labels
Browse files Browse the repository at this point in the history
  • Loading branch information
sdvg committed Nov 16, 2023
1 parent 5ace636 commit c7542fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/components/src/components/avatar/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class KolAvatarWc implements API {
<img alt="" aria-hidden="true" class="image" src={this.state._src} />
) : (
<span aria-hidden="true" class="initials">
{formatLabelAsInitials(this.state._label)}
{formatLabelAsInitials(this.state._label.trim())}
</span>
)}
</div>
Expand Down
4 changes: 3 additions & 1 deletion packages/samples/react/src/components/avatar/basic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import React, { FC } from 'react';
export const AvatarBasic: FC = () => (
<div className="flex flex-wrap gap-4">
<KolAvatar _src="https://www.w3schools.com/howto/img_avatar.png" _label="Elke Mustermann" />
<KolAvatar _label="Elke Mustermann" />

{/* intentional trailing space 👇 - it's supposed to be trimmed */}
<KolAvatar _label="Elke Mustermann " />
<KolAvatar _label="Marianne" />
</div>
);

0 comments on commit c7542fe

Please sign in to comment.