22// Use of this source code is governed by a BSD-style license that can be
33// found in the LICENSE file.
44
5+ import * as Lit from '../../../lit/lit.js' ;
56import * as ComponentHelpers from '../../helpers/helpers.js' ;
67import * as IconButton from '../../icon_button/icon_button.js' ;
78
9+ const { html} = Lit ;
10+
811await ComponentHelpers . ComponentServerSetup . setup ( ) ;
912
1013const iconTable = document . getElementById ( 'icon-overview' ) ;
1114
1215const row1 = document . createElement ( 'tr' ) ;
13- const iconName1 = document . createElement ( 'td' ) ;
14- iconName1 . textContent = 'select-element ' ;
15- row1 . appendChild ( iconName1 ) ;
16+ const iconDescription1 = document . createElement ( 'td' ) ;
17+ iconDescription1 . textContent = 'Programmatically created with default size and color ' ;
18+ row1 . appendChild ( iconDescription1 ) ;
1619
1720const icon = IconButton . Icon . create ( 'select-element' ) ;
1821const icon1 = document . createElement ( 'td' ) ;
@@ -21,69 +24,45 @@ row1.appendChild(icon1);
2124
2225iconTable ?. appendChild ( row1 ) ;
2326
24- icon . onclick = ( ) => {
25- // Change of colour through a data-setter, which rerenders the component. Getting the data first in order not to specify the data fields all over again
26- icon . data = { ...icon . data , color : 'blue' } ;
27- } ;
28-
2927const row2 = document . createElement ( 'tr' ) ;
30- const iconName2 = document . createElement ( 'td' ) ;
31- iconName2 . textContent = 'issue-exclamation-filled ' ;
32- row2 . appendChild ( iconName2 ) ;
28+ const iconDescription2 = document . createElement ( 'td' ) ;
29+ iconDescription2 . textContent = 'Programmatically created with custom size and color ' ;
30+ row2 . appendChild ( iconDescription2 ) ;
3331
3432const otherIcon = IconButton . Icon . create ( 'issue-exclamation-filled' ) ;
35- otherIcon . style . color = 'var(--icon-link)' ;
33+ otherIcon . classList . toggle ( 'custom-size-and-color' ) ;
3634const icon2 = document . createElement ( 'td' ) ;
3735icon2 . appendChild ( otherIcon ) ;
3836row2 . appendChild ( icon2 ) ;
3937
4038iconTable ?. appendChild ( row2 ) ;
4139
4240const row3 = document . createElement ( 'tr' ) ;
43- const iconName3 = document . createElement ( 'td' ) ;
44- iconName3 . textContent = 'select-element ' ;
45- row3 . appendChild ( iconName3 ) ;
41+ const iconDescription3 = document . createElement ( 'td' ) ;
42+ iconDescription3 . textContent = 'Created through html template with default size and color ' ;
43+ row3 . appendChild ( iconDescription3 ) ;
4644
47- const otherIcon2 = IconButton . Icon . create ( 'select-element' , 'custom-color' ) ;
4845const icon3 = document . createElement ( 'td' ) ;
49- icon3 . appendChild ( otherIcon2 ) ;
46+ Lit . render (
47+ html `
48+ < devtools-icon name ="select-element "> </ devtools-icon >
49+ ` ,
50+ icon3 ) ;
5051row3 . appendChild ( icon3 ) ;
5152
5253iconTable ?. appendChild ( row3 ) ;
5354
54- ( ( ) => {
55- const div = document . createElement ( 'div' ) ;
56- const span1 = document . createElement ( 'span' ) ;
57- span1 . textContent = 'Some text' ;
58- div . appendChild ( span1 ) ;
59- const otherIcon3 = IconButton . Icon . create ( 'select-element' , 'custom-color' ) ;
60- div . appendChild ( otherIcon3 ) ;
61- const span2 = document . createElement ( 'span' ) ;
62- span2 . textContent = 'with a large icon' ;
63- div . appendChild ( span2 ) ;
64- document . body . append ( div ) ;
65- } ) ( ) ;
66-
67- ( ( ) => {
68- const div = document . createElement ( 'div' ) ;
69- const span1 = document . createElement ( 'span' ) ;
70- span1 . textContent = 'Some text' ;
71- div . appendChild ( span1 ) ;
72- const otherIcon3 = IconButton . Icon . create ( 'select-element' , 'custom-color' ) ;
73- otherIcon3 . style . width = '14px' ;
74- otherIcon3 . style . height = '14px' ;
75- div . appendChild ( otherIcon3 ) ;
76- const span2 = document . createElement ( 'span' ) ;
77- span2 . textContent = 'with a small icon' ;
78- div . appendChild ( span2 ) ;
79-
80- document . body . append ( div ) ;
81- } ) ( ) ;
82-
83- const iconInFlex = document . getElementById ( 'icon-in-flex' ) as IconButton . Icon . Icon ;
84- iconInFlex . data = {
85- iconName : 'cross-circle' ,
86- width : '20px' ,
87- height : '20px' ,
88- color : 'var(--icon-error)' ,
89- } ;
55+ const row4 = document . createElement ( 'tr' ) ;
56+ const iconDescription4 = document . createElement ( 'td' ) ;
57+ iconDescription4 . textContent = 'Created through html template with custom size and color' ;
58+ row4 . appendChild ( iconDescription4 ) ;
59+
60+ const icon4 = document . createElement ( 'td' ) ;
61+ Lit . render (
62+ html `
63+ < devtools-icon name ="select-element " class ="custom-size-and-color "> </ devtools-icon >
64+ ` ,
65+ icon4 ) ;
66+ row4 . appendChild ( icon4 ) ;
67+
68+ iconTable ?. appendChild ( row4 ) ;
0 commit comments