mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 15:35:49 +01:00
added option to pass className prop to AvatarImage
This commit is contained in:
@@ -7,17 +7,21 @@ import { useBinder } from "@scm-manager/ui-extensions";
|
||||
type Props = {
|
||||
person: Person;
|
||||
representation?: "rounded" | "rounded-border";
|
||||
className?: string;
|
||||
};
|
||||
|
||||
const AvatarImage: FC<Props> = ({ person, representation = "rounded-border" }) => {
|
||||
const AvatarImage: FC<Props> = ({ person, representation = "rounded-border", className }) => {
|
||||
const binder = useBinder();
|
||||
const avatarFactory = binder.getExtension(EXTENSION_POINT);
|
||||
if (avatarFactory) {
|
||||
const avatar = avatarFactory(person);
|
||||
|
||||
const className = representation === "rounded" ? "is-rounded" : "has-rounded-border";
|
||||
let classes = representation === "rounded" ? "is-rounded" : "has-rounded-border";
|
||||
if (className) {
|
||||
classes += " " + className;
|
||||
}
|
||||
|
||||
return <Image className={className} src={avatar} alt={person.name} />;
|
||||
return <Image className={classes} src={avatar} alt={person.name} />;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user