Skip to content

Commit

Permalink
feat: adds avatar.img.base to avatar theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardo Lüders authored and tulup-conner committed Jun 20, 2023
1 parent 89f7250 commit 427a56f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/components/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface FlowbiteAvatarRootTheme {
}

export interface FlowbiteAvatarImageTheme extends FlowbiteBoolean {
base: string;
placeholder: string;
}

Expand Down Expand Up @@ -92,6 +93,7 @@ const AvatarComponent: FC<AvatarProps> = ({
const theme = mergeDeep(useTheme().theme.avatar, customTheme);

const imgClassName = twMerge(
theme.root.img.base,
bordered && theme.root.bordered,
bordered && theme.root.color[color],
rounded && theme.root.rounded,
Expand All @@ -118,11 +120,11 @@ const AvatarComponent: FC<AvatarProps> = ({
className={twMerge(
theme.root.img.off,
theme.root.initials.base,
rounded && theme.root.rounded,
stacked && theme.root.stacked,
bordered && theme.root.bordered,
bordered && theme.root.color[color],
theme.root.size[size],
rounded && theme.root.rounded,
)}
data-testid="flowbite-avatar-initials-placeholder"
>
Expand Down
9 changes: 5 additions & 4 deletions src/components/Avatar/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import type { FlowbiteAvatarTheme } from "./Avatar";

export const avatarTheme: FlowbiteAvatarTheme = {
root: {
base: 'flex justify-center items-center space-x-4',
base: 'flex justify-center items-center space-x-4 rounded',
bordered: 'p-1 ring-2',
rounded: '!rounded-full',
rounded: 'rounded-full',
color: {
dark: 'ring-gray-800 dark:ring-gray-800',
failure: 'ring-red-500 dark:ring-red-700',
Expand All @@ -17,8 +17,9 @@ export const avatarTheme: FlowbiteAvatarTheme = {
pink: 'ring-pink-500 dark:ring-pink-500',
},
img: {
off: 'rounded relative overflow-hidden bg-gray-100 dark:bg-gray-600',
on: 'rounded',
base: 'rounded',
off: 'relative overflow-hidden bg-gray-100 dark:bg-gray-600',
on: '',
placeholder: 'absolute w-auto h-auto text-gray-400 -bottom-1',
},
size: {
Expand Down

0 comments on commit 427a56f

Please sign in to comment.