import React, { useMemo } from "react";
import { useSelector } from "react-redux";
import PropTypes from "prop-types";
import InfosButton from "../InfosButton";
function TopicInfosButton(_ref) {
  let {
    topic
  } = _ref;
  const activeTopic = useSelector(state => state.app.activeTopic);
  const className = useMemo(() => {
    const classes = ["wkp-info-bt"];
    if ((activeTopic === null || activeTopic === void 0 ? void 0 : activeTopic.key) === topic.key) {
      classes.push("wkp-active");
    }
    return classes.join(" ");
  }, [activeTopic.key, topic]);
  if (!topic) {
    return null;
  }
  return /*#__PURE__*/React.createElement(InfosButton, {
    className: className,
    selectedInfo: topic
  });
}
TopicInfosButton.propTypes = {
  topic: PropTypes.object.isRequired
};
export default /*#__PURE__*/React.memo(TopicInfosButton);
//# sourceMappingURL=TopicInfosButton.js.map