Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/docs/pages/AvatarPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,22 @@ const AvatarPage: FC = () => {
),
},
{
title: 'Placeholder',
title: 'Placeholder Initials',
code: (
<div className="flex flex-wrap gap-2">
<Avatar />
<Avatar rounded />
<Avatar placeholderInitials="RR" />
</div>
),
},
{
title: 'Placeholder Initials',
title: 'Placeholder Initials - Sizing',
code: (
<div className="flex flex-wrap gap-2">
<Avatar placeholderInitials="RR" />
<div className="flex flex-wrap items-center gap-2">
<Avatar placeholderInitials="RR" size="xs" />
<Avatar placeholderInitials="RR" size="sm" />
<Avatar placeholderInitials="RR" size="md" />
<Avatar placeholderInitials="RR" size="lg" />
<Avatar placeholderInitials="RR" size="xl" />
</div>
),
},
Expand Down
9 changes: 9 additions & 0 deletions src/lib/components/Avatar/Avatar.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ describe('Components / Avatar', () => {
expect(initialsPlaceholderText()).toHaveTextContent('RR');
});

it('should support explicit sizes with placeholder initials', () => {
render(
<Flowbite>
<Avatar placeholderInitials="RR" size="xl" />
</Flowbite>,
);

expect(initialsPlaceholder()).toHaveClass('h-36 w-36');
});
it('should support border color with placeholder initials', () => {
render(
<Flowbite>
Expand Down
1 change: 1 addition & 0 deletions src/lib/components/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ const AvatarComponent: FC<AvatarProps> = ({
stacked && theme.root.stacked,
bordered && theme.root.bordered,
bordered && theme.root.color[color],
theme.root.size[size],
)}
data-testid="flowbite-avatar-initials-placeholder"
>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/theme/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const theme: FlowbiteTheme = {
},
initials: {
text: 'font-medium text-gray-600 dark:text-gray-300',
base: 'inline-flex overflow-hidden relative justify-center items-center w-10 h-10 bg-gray-100 dark:bg-gray-600',
base: 'inline-flex overflow-hidden relative justify-center items-center bg-gray-100 dark:bg-gray-600',
},
},
group: {
Expand Down