@@ -8,12 +8,13 @@ function EmbedTab(props) {
8
8
const { t } = useTranslation ( ) ;
9
9
const tabName = [
10
10
{ title : "React/Next.js" , icon : "fa-brands fa-react" , color : "#61dafb" } ,
11
+ { title : "JavaScript" , icon : "fa-brands fa-js" , color : "#ffd43b" } ,
11
12
{ title : "Angular" , icon : "fa-brands fa-angular" , color : "#ff5733" }
12
13
] ;
13
14
const [ activeTab , setActiveTab ] = useState ( 0 ) ;
14
15
// State to track if the code has been copied
15
16
const [ isCopied , setIsCopied ] = useState ( false ) ;
16
- const codeData = [
17
+ const reactCode = [
17
18
{
18
19
id : 0 ,
19
20
title : "Installation" ,
@@ -44,6 +45,51 @@ export function App() {
44
45
}
45
46
] ;
46
47
48
+ const angularCode = [
49
+ {
50
+ id : 0 ,
51
+ title : "Installation" ,
52
+ codeString : `
53
+ npm install opensign-angular`
54
+ } ,
55
+ {
56
+ id : 1 ,
57
+ title : "Usage" ,
58
+ codeString : `
59
+ import { Component } from '@angular/core';
60
+ import {OpensignComponent} from "opensign-angular"
61
+
62
+ @Component({
63
+ selector:'app-root',
64
+ standalone: true,
65
+ imports: [OpensignComponent],
66
+ template: '<opensign templateId={"${ props . templateId } "}
67
+ (onLoad)="handleLoad()"
68
+ (onLoadError)="handleError($event)"
69
+ ></opensign>',
70
+ })
71
+ export class AppComponent{
72
+ handleLoad() {
73
+ console.log("success");
74
+ }
75
+ handleError(error: string) {
76
+ console.log(error);
77
+ }
78
+
79
+ }
80
+
81
+
82
+ `
83
+ }
84
+ ] ;
85
+ const jsCodeString = `
86
+ <script
87
+ src= "https://app.opensignlabs.com/static/js/public-template.bundle.js"
88
+ id="opensign-script"
89
+ templateId=${ props . templateId }
90
+ ></script>
91
+ ` ;
92
+
47
93
const handleCopy = ( code , ind ) => {
48
94
copytoData ( code ) ;
49
95
setIsCopied ( { ...isCopied , [ ind ] : true } ) ;
@@ -75,7 +121,7 @@ export function App() {
75
121
< div >
76
122
{ activeTab === 0 ? (
77
123
< div className = "mt-4" >
78
- { codeData . map ( ( data , ind ) => {
124
+ { reactCode . map ( ( data , ind ) => {
79
125
return (
80
126
< div key = { ind } >
81
127
< p className = "font-medium text-[18px]" >
@@ -133,10 +179,93 @@ export function App() {
133
179
{ t ( "public-template-mssg-5" ) }
134
180
</ p >
135
181
</ div >
182
+ ) : activeTab === 1 ? (
183
+ < div className = "mt-4" >
184
+ < div >
185
+ { /* <p className="font-medium text-[18px]">{t(`${data.title}`)}</p> */ }
186
+
187
+ < div className = "relative p-1" >
188
+ < div
189
+ onClick = { ( ) => handleCopy ( jsCodeString , 0 ) }
190
+ className = "absolute top-[20px] right-[20px] cursor-pointer"
191
+ >
192
+ < i className = "fa-light fa-copy text-white mr-[2px]" />
193
+ < span className = " text-white" >
194
+ { isCopied [ 0 ] ? t ( "copied-code" ) : t ( "copy-code" ) }
195
+ </ span >
196
+ </ div >
197
+ < SyntaxHighlighter
198
+ customStyle = { {
199
+ borderRadius : "15px"
200
+ } }
201
+ language = "javascript"
202
+ style = { tomorrow }
203
+ >
204
+ { jsCodeString }
205
+ </ SyntaxHighlighter >
206
+ </ div >
207
+ </ div >
208
+ </ div >
136
209
) : (
137
- activeTab === 1 && (
138
- < div className = "mt-3" >
139
- < p > Feature comming soon</ p >
210
+ activeTab === 2 && (
211
+ < div className = "mt-4" >
212
+ { angularCode . map ( ( data , ind ) => {
213
+ return (
214
+ < div key = { ind } >
215
+ < p className = "font-medium text-[18px]" >
216
+ { t ( `${ data . title } ` ) }
217
+ </ p >
218
+ { ind === 0 && (
219
+ < p className = "text-[13px] mt-2" >
220
+ { t ( "public-template-mssg-1" ) }
221
+ </ p >
222
+ ) }
223
+ < div className = "relative p-1" >
224
+ < div
225
+ onClick = { ( ) => handleCopy ( data . codeString , ind ) }
226
+ className = "absolute top-[20px] right-[20px] cursor-pointer"
227
+ >
228
+ < i className = "fa-light fa-copy text-white mr-[2px]" />
229
+ < span className = " text-white" >
230
+ { isCopied [ ind ] ? t ( "copied-code" ) : t ( "copy-code" ) }
231
+ </ span >
232
+ </ div >
233
+ < SyntaxHighlighter
234
+ customStyle = { {
235
+ borderRadius : "15px"
236
+ } }
237
+ language = "javascript"
238
+ style = { tomorrow }
239
+ >
240
+ { data . codeString }
241
+ </ SyntaxHighlighter >
242
+ </ div >
243
+ { ind === 0 && (
244
+ < p className = "text-[13px] mb-3" >
245
+ { t ( "public-template-mssg-2" ) }
246
+ </ p >
247
+ ) }
248
+ </ div >
249
+ ) ;
250
+ } ) }
251
+
252
+ < p className = "font-medium text-[15px]" >
253
+ { t ( "public-template-mssg-3" ) }
254
+ </ p >
255
+ < p className = "my-[6px]" >
256
+ { " " }
257
+ { t ( "public-template-mssg-4" ) }
258
+ < a
259
+ href = "https://www.npmjs.com/package/opensignme-angular"
260
+ target = "_blank"
261
+ rel = "noreferrer"
262
+ className = "cursor-pointer text-blue-700 "
263
+ >
264
+ { " " }
265
+ OpenSign Angular package{ " " }
266
+ </ a >
267
+ { t ( "public-template-mssg-5" ) }
268
+ </ p >
140
269
</ div >
141
270
)
142
271
) }
0 commit comments