mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 07:25:44 +01:00
use reflow to migrate from flow to typescript
This commit is contained in:
28
scm-ui/ui-components/src/avatar/AvatarImage.tsx
Normal file
28
scm-ui/ui-components/src/avatar/AvatarImage.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import React from 'react';
|
||||
import { binder } from '@scm-manager/ui-extensions';
|
||||
import { Image } from '..';
|
||||
import { Person } from './Avatar';
|
||||
import { EXTENSION_POINT } from './Avatar';
|
||||
|
||||
type Props = {
|
||||
person: Person;
|
||||
};
|
||||
|
||||
class AvatarImage extends React.Component<Props> {
|
||||
render() {
|
||||
const { person } = this.props;
|
||||
|
||||
const avatarFactory = binder.getExtension(EXTENSION_POINT);
|
||||
if (avatarFactory) {
|
||||
const avatar = avatarFactory(person);
|
||||
|
||||
return (
|
||||
<Image className="has-rounded-border" src={avatar} alt={person.name} />
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export default AvatarImage;
|
||||
Reference in New Issue
Block a user