File tree Expand file tree Collapse file tree 6 files changed +30
-50
lines changed
drop-down-button/item-template-cs1/app Expand file tree Collapse file tree 6 files changed +30
-50
lines changed Original file line number Diff line number Diff line change @@ -36,30 +36,20 @@ function App() {
36
36
}
37
37
] ;
38
38
39
+ const template = `
40
+ <div>
41
+ <span class='e-menu-icon ${ '${iconCss}' } '></span>
42
+ ${
43
+ '${url}'
44
+ ? `<span class='custom-class'><a href='${ '${url}' } ' target='_blank' rel='noopener noreferrer'>${ '${text}' } </a></span>`
45
+ : `<span class='custom-class'>${ '${text}' } </span>`
46
+ }
47
+ </div>
48
+ ` ;
49
+
39
50
return (
40
51
< div >
41
- < DropDownButtonComponent
42
- items = { items }
43
- itemTemplate = { ( data ) => {
44
- if ( data . url ) {
45
- return (
46
- < div >
47
- < span className = { `e-menu-icon ${ data . iconCss } ` } > </ span >
48
- < span class = "custom-class" > < a href = { data . url } target = "_blank" rel = "noopener noreferrer" > { data . text } </ a > </ span >
49
- </ div >
50
- ) ;
51
- } else {
52
- return (
53
- < div >
54
- < span className = { `e-menu-icon ${ data . iconCss } ` } > </ span >
55
- < span class = "custom-class" > { data . text } </ span >
56
- </ div >
57
- ) ;
58
- }
59
- } }
60
- >
61
- DropDownButton
62
- </ DropDownButtonComponent >
52
+ < DropDownButtonComponent items = { items } itemTemplate = { template } > DropDownButton</ DropDownButtonComponent >
63
53
</ div >
64
54
) ;
65
55
}
Original file line number Diff line number Diff line change @@ -36,30 +36,20 @@ function App() {
36
36
}
37
37
] ;
38
38
39
+ const template : string = `
40
+ <div>
41
+ <span class='e-menu-icon ${ '${iconCss}' } '></span>
42
+ ${
43
+ '${url}'
44
+ ? `<span class='custom-class'><a href='${ '${url}' } ' target='_blank' rel='noopener noreferrer'>${ '${text}' } </a></span>`
45
+ : `<span class='custom-class'>${ '${text}' } </span>`
46
+ }
47
+ </div>
48
+ ` ;
49
+
39
50
return (
40
51
< div >
41
- < DropDownButtonComponent
42
- items = { items }
43
- itemTemplate = { ( data : ItemModel ) => {
44
- if ( data . url ) {
45
- return (
46
- < div >
47
- < span className = { `e-menu-icon ${ data . iconCss } ` } > </ span >
48
- < span class = "custom-class" > < a href = { data . url } target = "_blank" rel = "noopener noreferrer" > { data . text } </ a > </ span >
49
- </ div >
50
- ) ;
51
- } else {
52
- return (
53
- < div >
54
- < span className = { `e-menu-icon ${ data . iconCss } ` } > </ span >
55
- < span class = "custom-class" > { data . text } </ span >
56
- </ div >
57
- ) ;
58
- }
59
- } }
60
- >
61
- DropDownButton
62
- </ DropDownButtonComponent >
52
+ < DropDownButtonComponent items = { items } itemTemplate = { template } > DropDownButton</ DropDownButtonComponent >
63
53
</ div >
64
54
) ;
65
55
}
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export default class App extends React.Component {
15
15
}
16
16
render ( ) {
17
17
return ( < div className = 'e-img-editor-sample' >
18
- < ImageEditorComponent ref = { ( img ) => { this . imgObj = img ; } } height = "350px" uploadSettings = { uploadSettings } >
18
+ < ImageEditorComponent ref = { ( img ) => { this . imgObj = img ; } } height = "350px" uploadSettings = { this . uploadSettings } >
19
19
</ ImageEditorComponent >
20
20
< div >
21
21
< ButtonComponent cssClass = 'e-primary' content = 'Load Invalid Image' onClick = { this . loadInvalidImage . bind ( this ) } />
Original file line number Diff line number Diff line change @@ -18,10 +18,10 @@ function App() {
18
18
19
19
return (
20
20
< div className = 'e-img-editor-sample' >
21
- < ImageEditorComponent ref = { ( img ) => { imgObj = img } } uploadSettings = { uploadSettings } >
21
+ < ImageEditorComponent ref = { ( img ) => { imgObj = img } } height = "350px" uploadSettings = { this . uploadSettings } >
22
22
</ ImageEditorComponent >
23
23
< div >
24
- < ButtonComponent cssClass = 'e-primary' content = 'Load Invalid Image' onClick = { loadInvalidImage } />
24
+ < ButtonComponent cssClass = 'e-primary' content = 'Load Invalid Image' onClick = { this . loadInvalidImage . bind ( this ) } />
25
25
</ div >
26
26
</ div >
27
27
) ;
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export default class App extends React.Component {
16
16
}
17
17
render ( ) {
18
18
return ( < div className = 'e-img-editor-sample' >
19
- < ImageEditorComponent ref = { ( img ) => { this . imgObj = img ; } } height = "350px" uploadSettings = { uploadSettings } >
19
+ < ImageEditorComponent ref = { ( img ) => { this . imgObj = img ; } } height = "350px" uploadSettings = { this . uploadSettings } >
20
20
</ ImageEditorComponent >
21
21
< div >
22
22
< ButtonComponent cssClass = 'e-primary' content = 'Load Invalid Image' onClick = { this . loadInvalidImage . bind ( this ) } />
Original file line number Diff line number Diff line change @@ -19,10 +19,10 @@ function App() {
19
19
20
20
return (
21
21
< div className = 'e-img-editor-sample' >
22
- < ImageEditorComponent ref = { ( img ) => { imgObj = img } } uploadSettings = { uploadSettings } >
22
+ < ImageEditorComponent ref = { ( img ) => { imgObj = img } } height = "350px" uploadSettings = { this . uploadSettings } >
23
23
</ ImageEditorComponent >
24
24
< div >
25
- < ButtonComponent cssClass = 'e-primary' content = 'Load Invalid Image' onClick = { loadInvalidImage } />
25
+ < ButtonComponent cssClass = 'e-primary' content = 'Load Invalid Image' onClick = { this . loadInvalidImage . bind ( this ) } />
26
26
</ div >
27
27
</ div >
28
28
) ;
You can’t perform that action at this time.
0 commit comments