mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 15:05:44 +01:00
use binder from context to make extensions it testable
This commit is contained in:
@@ -1,18 +1,13 @@
|
||||
import React, { Component, ReactNode } from "react";
|
||||
import { binder } from "@scm-manager/ui-extensions";
|
||||
import React, { FC } from "react";
|
||||
import { useBinder } from "@scm-manager/ui-extensions";
|
||||
import { EXTENSION_POINT } from "./Avatar";
|
||||
|
||||
type Props = {
|
||||
children: ReactNode;
|
||||
const AvatarWrapper: FC = ({ children }) => {
|
||||
const binder = useBinder();
|
||||
if (binder.hasExtension(EXTENSION_POINT)) {
|
||||
return <>{children}</>;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
class AvatarWrapper extends Component<Props> {
|
||||
render() {
|
||||
if (binder.hasExtension(EXTENSION_POINT)) {
|
||||
return <>{this.props.children}</>;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export default AvatarWrapper;
|
||||
|
||||
Reference in New Issue
Block a user