import React, { useEffect, useState } from 'react';
import Loading from "../Loading";
import { TextWrap } from "./TextWrap";
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
const Text = ({
  media,
  mediaVisible,
  isDetail: _isDetail = true
}) => {
  const [content, setContent] = useState('');
  useEffect(() => {
    fetch(media).then(r => r.text()).then(r => setContent(r));
  }, [media]);
  return /*#__PURE__*/_jsxs(TextWrap, {
    mediaVisible: mediaVisible,
    isDetail: _isDetail,
    children: [/*#__PURE__*/_jsx(Loading, {
      cssStyle: `
          display: ${_isDetail && content && 'none'};
        `
    }), /*#__PURE__*/_jsx("div", {
      className: "hideScrollbar",
      children: content
    })]
  });
};
export default Text;