From 6551b2537a1039d842b1104d70b0647bbb172f2c Mon Sep 17 00:00:00 2001 From: RaktimaNXG Date: Wed, 18 Sep 2024 16:48:20 +0530 Subject: [PATCH] feat: implement angular npm package use case in public template --- apps/OpenSign/src/components/pdf/EmbedTab.js | 139 ++++++++++++++++++- 1 file changed, 134 insertions(+), 5 deletions(-) diff --git a/apps/OpenSign/src/components/pdf/EmbedTab.js b/apps/OpenSign/src/components/pdf/EmbedTab.js index 60caaab12..f0525df1a 100644 --- a/apps/OpenSign/src/components/pdf/EmbedTab.js +++ b/apps/OpenSign/src/components/pdf/EmbedTab.js @@ -8,12 +8,13 @@ function EmbedTab(props) { const { t } = useTranslation(); const tabName = [ { title: "React/Next.js", icon: "fa-brands fa-react", color: "#61dafb" }, + { title: "JavaScript", icon: "fa-brands fa-js", color: "#ffd43b" }, { title: "Angular", icon: "fa-brands fa-angular", color: "#ff5733" } ]; const [activeTab, setActiveTab] = useState(0); // State to track if the code has been copied const [isCopied, setIsCopied] = useState(false); - const codeData = [ + const reactCode = [ { id: 0, title: "Installation", @@ -44,6 +45,51 @@ export function App() { } ]; + const angularCode = [ + { + id: 0, + title: "Installation", + codeString: ` +npm install opensign-angular` + }, + { + id: 1, + title: "Usage", + codeString: ` +import { Component } from '@angular/core'; +import {OpensignComponent} from "opensign-angular" + +@Component({ + selector:'app-root', + standalone: true, + imports: [OpensignComponent], + template: '', +}) +export class AppComponent{ + handleLoad() { + console.log("success"); + } + handleError(error: string) { + console.log(error); + } + +} + + +` + } + ]; + const jsCodeString = ` + + `; + const handleCopy = (code, ind) => { copytoData(code); setIsCopied({ ...isCopied, [ind]: true }); @@ -75,7 +121,7 @@ export function App() {
{activeTab === 0 ? (
- {codeData.map((data, ind) => { + {reactCode.map((data, ind) => { return (

@@ -133,10 +179,93 @@ export function App() { {t("public-template-mssg-5")}

+ ) : activeTab === 1 ? ( +
+
+ {/*

{t(`${data.title}`)}

*/} + +
+
handleCopy(jsCodeString, 0)} + className="absolute top-[20px] right-[20px] cursor-pointer" + > + + + {isCopied[0] ? t("copied-code") : t("copy-code")} + +
+ + {jsCodeString} + +
+
+
) : ( - activeTab === 1 && ( -
-

Feature comming soon

+ activeTab === 2 && ( +
+ {angularCode.map((data, ind) => { + return ( +
+

+ {t(`${data.title}`)} +

+ {ind === 0 && ( +

+ {t("public-template-mssg-1")} +

+ )} +
+
handleCopy(data.codeString, ind)} + className="absolute top-[20px] right-[20px] cursor-pointer" + > + + + {isCopied[ind] ? t("copied-code") : t("copy-code")} + +
+ + {data.codeString} + +
+ {ind === 0 && ( +

+ {t("public-template-mssg-2")} +

+ )} +
+ ); + })} + +

+ {t("public-template-mssg-3")} +

+

+ {" "} + {t("public-template-mssg-4")} + + {" "} + OpenSign Angular package{" "} + + {t("public-template-mssg-5")} +

) )}