mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-18 03:01:05 +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 = {
|
type Props = {
|
||||||
person: Person;
|
person: Person;
|
||||||
representation?: "rounded" | "rounded-border";
|
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 binder = useBinder();
|
||||||
const avatarFactory = binder.getExtension(EXTENSION_POINT);
|
const avatarFactory = binder.getExtension(EXTENSION_POINT);
|
||||||
if (avatarFactory) {
|
if (avatarFactory) {
|
||||||
const avatar = avatarFactory(person);
|
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;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user