Dynamiclly load Link, Image and Button on file page

This commit is contained in:
Lee 2022-11-17 08:16:45 +00:00
parent c907abeba3
commit 5a1d7d7645
No known key found for this signature in database
GPG Key ID: 6EA25896ECCB3121

@ -1,12 +1,13 @@
import { Button } from "@nextui-org/react";
import moment from "moment/moment";
import { NextSeo } from "next-seo"; import { NextSeo } from "next-seo";
import Image from "next/image"; import dynamic from "next/dynamic";
import Link from "next/link";
import { getFileInfo } from "src/utils/helpers/fileHelpers"; import { getFileInfo } from "src/utils/helpers/fileHelpers";
import { formatBytes } from "src/utils/helpers/stringHelpers"; import { formatBytes } from "src/utils/helpers/stringHelpers";
import { downloadURI } from "src/utils/helpers/webUtils"; import { downloadURI } from "src/utils/helpers/webUtils";
const Link = dynamic(() => import("next/link"));
const Image = dynamic(() => import("next/image"));
const Button = dynamic(() => import("@nextui-org/react/button"));
export default function File({ isValidFile, fileData }) { export default function File({ isValidFile, fileData }) {
const file = JSON.parse(fileData); const file = JSON.parse(fileData);
let { let {
@ -115,7 +116,7 @@ export default function File({ isValidFile, fileData }) {
<h1 className="font-bold text-lg"> <h1 className="font-bold text-lg">
{originalFileName} ({fileId}.{ext}) {originalFileName} ({fileId}.{ext})
</h1> </h1>
<h3>{moment(uploadDate).format("MMMM Do YYYY, h:mm:ss a")}</h3> <h3>{uploadDate}</h3>
<h3> <h3>
Uploader: <span className="font-bold">{uploader.username}</span> -{" "} Uploader: <span className="font-bold">{uploader.username}</span> -{" "}
{formatBytes(size)} {formatBytes(size)}