Add footer extension points for links and avatar

This commit is contained in:
Eduard Heimbuch
2020-02-18 13:10:37 +01:00
parent 1ff0c46b0e
commit 61d7d5e6dd
5 changed files with 69 additions and 22 deletions

View File

@@ -1,4 +1,4 @@
import React from "react";
import React, {FC} from "react";
import { binder } from "@scm-manager/ui-extensions";
import { Image } from "..";
import { Person } from "./Avatar";
@@ -6,21 +6,20 @@ import { EXTENSION_POINT } from "./Avatar";
type Props = {
person: Person;
representation?: "rounded" | "rounded-border";
};
class AvatarImage extends React.Component<Props> {
render() {
const { person } = this.props;
const AvatarImage:FC<Props> = ({person, representation = "rounded-border"}) => {
const avatarFactory = binder.getExtension(EXTENSION_POINT);
if (avatarFactory) {
const avatar = avatarFactory(person);
return <Image className="has-rounded-border" src={avatar} alt={person.name} />;
const className = representation === "rounded" ? "is-rounded" : "has-rounded-border";
return <Image className={className} src={avatar} alt={person.name} />;
}
return null;
}
}
};
export default AvatarImage;