Skip to content

Commit

Permalink
update mime
Browse files Browse the repository at this point in the history
  • Loading branch information
ashik-75 committed Sep 10, 2023
1 parent 3864756 commit 152a655
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
Binary file added ui/public/mime/avif.avif
Binary file not shown.
Binary file added ui/public/mime/image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ui/public/mime/pdf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 26 additions & 6 deletions ui/src/pages/info/Mimetype/utils/constants.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import { ColumnsType } from "antd/es/table";
import { MIME_TABLE_TYPE } from "./types";
import imageJpg from "assets/about.jpg";

// Define a function to render different MIME types
const renderMIMEType = (value: string) => {
if (value.endsWith(".jpg")) {
if (
value.endsWith(".jpg") ||
value.endsWith(".jpeg") ||
value.endsWith(".png") ||
value.endsWith(".avif")
) {
return (
<div>
<img
style={{ width: "80px", height: "50px" }}
src={imageJpg}
style={{
width: "80px",
height: "50px",
objectFit: "contain",
}}
src={value}
alt=""
/>
</div>
Expand All @@ -26,7 +34,7 @@ const renderMIMEType = (value: string) => {
if (value.endsWith(".mp4")) {
return (
<div>
<video width={250} height={100} src={value} controls></video>
<video width={200} height={100} src={value} controls></video>
</div>
);
}
Expand Down Expand Up @@ -64,7 +72,7 @@ const MIME_DATA: MIME_TABLE_TYPE[] = [
{
key: "2",
name: ".jpeg or .jpg",
example: `/bg.jpg`,
example: `/mime/image.jpg`,
code: "image/jpeg",
},
{
Expand All @@ -85,6 +93,18 @@ const MIME_DATA: MIME_TABLE_TYPE[] = [
example: `/mime/video.mp4`,
code: "video/mp4",
},
{
key: "6",
name: ".avif",
example: `/mime/avif.avif`,
code: "video/mp4",
},
{
key: "7",
name: ".mp4",
example: `/mime/pdf.png`,
code: "video/mp4",
},
];

export { MIME_COLUMNS, MIME_DATA };

0 comments on commit 152a655

Please sign in to comment.