import { useRouter } from 'next/router' import { useTranslation } from 'next-i18next' import FourOhFour from '../FourOhFour' import Loading from '../Loading' import DownloadButtonGroup from '../DownloadBtnGtoup' import useFileContent from '../../utils/fetchOnMount' import { DownloadBtnContainer, PreviewContainer } from './Containers' const TextPreview = ({ file }) => { const { asPath } = useRouter() const { t } = useTranslation() const { response: content, error, validating } = useFileContent(`/api/raw/?path=${asPath}`, asPath) if (error) { return ( ) } if (validating) { return ( <> ) } if (!content) { return ( <> ) } return (
{content}
) } export default TextPreview