diff --git a/src/front/Components/DesignSystem/FilePreview/classes.module.scss b/src/front/Components/DesignSystem/FilePreview/classes.module.scss new file mode 100644 index 00000000..95b916b2 --- /dev/null +++ b/src/front/Components/DesignSystem/FilePreview/classes.module.scss @@ -0,0 +1,16 @@ +.root { + height: inherit; + .file-container { + height: inherit; + .image { + width: 100%; + height: inherit; + object-fit: contain; + } + + .pdf { + width: 100%; + height: inherit; + } + } +} diff --git a/src/front/Components/DesignSystem/FilePreview/index.tsx b/src/front/Components/DesignSystem/FilePreview/index.tsx new file mode 100644 index 00000000..37ad48e0 --- /dev/null +++ b/src/front/Components/DesignSystem/FilePreview/index.tsx @@ -0,0 +1,32 @@ +import React from "react"; + +import Typography, { ITypo, ITypoColor } from "../Typography"; +import classes from "./classes.module.scss"; + +type IProps = { + href: string; +}; +type IState = {}; + +export default class FilePreview extends React.Component { + override render() { + const type = this.props.href.split(".").pop(); + return ( +
+ {!type && ( + + Erreur lors du chargement du fichier + + )} + {type && ( +
+ {type === "pdf" && ( + + )} + {type !== "pdf" && File preview} +
+ )} +
+ ); + } +} diff --git a/src/front/Components/Layouts/DesignSystem/index.tsx b/src/front/Components/Layouts/DesignSystem/index.tsx index 20445c3f..57aa28fa 100644 --- a/src/front/Components/Layouts/DesignSystem/index.tsx +++ b/src/front/Components/Layouts/DesignSystem/index.tsx @@ -1,6 +1,7 @@ import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button"; import CheckBox from "@Front/Components/DesignSystem/CheckBox"; import DocumentNotary from "@Front/Components/DesignSystem/Document/DocumentNotary"; +import FilePreview from "@Front/Components/DesignSystem/FilePreview"; import FolderContainer from "@Front/Components/DesignSystem/FolderContainer"; import FolderList from "@Front/Components/DesignSystem/FolderListContainer"; import InputField from "@Front/Components/DesignSystem/Form/Elements/InputField"; @@ -268,6 +269,18 @@ export default class DesignSystem extends BasePage { + +
+
+ Preview Image/Pdf +
+
+
+ +
+ +
+
);