import { observer } from "mobx-react-lite";

import { useAvatarStore } from "src/Stores";

import type { FC } from "react";

export default function withTotem<T extends object>(Component: FC<T>) {
  return observer((props: T) => {
    const { totem } = useAvatarStore();

    if (!totem) {
      return null;
    }

    return <Component {...props} />;
  });
}
