mirror of
https://github.com/morten-olsen/refocus.dev.git
synced 2026-02-08 00:46:25 +01:00
init
This commit is contained in:
19
packages/sdk/src/clients/linear/with-linear.tsx
Normal file
19
packages/sdk/src/clients/linear/with-linear.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { useLinear } from '.';
|
||||
|
||||
const withLinear = <TProps extends object>(
|
||||
Component: React.ComponentType<TProps>,
|
||||
FallBack: React.ComponentType<object>,
|
||||
) => {
|
||||
const WrappedComponent: React.FC<TProps> = (props) => {
|
||||
const linear = useLinear();
|
||||
|
||||
if (!linear.client) {
|
||||
return <FallBack />;
|
||||
}
|
||||
return <Component {...props} />;
|
||||
};
|
||||
|
||||
return WrappedComponent;
|
||||
};
|
||||
|
||||
export { withLinear };
|
||||
Reference in New Issue
Block a user