11import { LitElement , css , html } from 'lit' ;
22import { iconRemixInformationFill as iconInfo } from '../../assets/cc-remix.icons.js' ;
3+ import { fakeString } from '../../lib/fake-strings.js' ;
34import { i18n } from '../../translations/translation.js' ;
45import '../cc-addon-credentials-content/cc-addon-credentials-content.js' ;
56import '../cc-block-details/cc-block-details.js' ;
@@ -34,7 +35,6 @@ import '../cc-toggle/cc-toggle.js';
3435export class CcAddonCredentialsBeta extends LitElement {
3536 static get properties ( ) {
3637 return {
37- docLink : { type : Object , attribute : 'doc-link' } ,
3838 state : { type : Object } ,
3939 _selectedTabName : { type : String , state : true } ,
4040 } ;
@@ -43,11 +43,16 @@ export class CcAddonCredentialsBeta extends LitElement {
4343 constructor ( ) {
4444 super ( ) ;
4545
46- /** @type {{ text: string; href: string; } } */
47- this . docLink = null ;
48-
4946 /** @type {AddonCredentialsBetaState } */
50- this . state = { type : 'loading' , tabs : { default : [ ] } } ;
47+ this . state = {
48+ type : 'loading' ,
49+ tabs : {
50+ default : {
51+ content : [ ] ,
52+ docLink : { text : fakeString ( 10 ) , href : null } ,
53+ } ,
54+ } ,
55+ } ;
5156
5257 /** @type {TabName } */
5358 this . _selectedTabName = 'default' ;
@@ -108,7 +113,7 @@ export class CcAddonCredentialsBeta extends LitElement {
108113 const skeleton = this . state . type === 'loading' ;
109114 const tabNames = /** @type {TabName[] } */ ( Object . keys ( this . state . tabs ) ) ;
110115 const toggleChoices = this . _getToggleChoices ( tabNames ) ;
111- const activeTabContent = this . state . tabs [ this . _selectedTabName ] ?? Object . values ( this . state . tabs ) [ 0 ] ;
116+ const activeTab = this . state . tabs [ this . _selectedTabName ] ?? Object . values ( this . state . tabs ) [ 0 ] ;
112117
113118 return html `
114119 <cc- block>
@@ -127,19 +132,15 @@ export class CcAddonCredentialsBeta extends LitElement {
127132 ${ this . state . type === 'loaded' || this . state . type === 'loading'
128133 ? html `
129134 <cc- addon- credentials- content
130- .credentials = "${ activeTabContent } "
135+ .credentials = "${ activeTab . content } "
131136 .skeleton = "${ skeleton } "
132137 slot= "content"
133138 > </ cc- addon- credentials- content>
134139 `
135140 : '' }
136- ${ this . docLink != null
137- ? html `
138- <div slot= "footer-right" >
139- <cc- link .href = "${ this . docLink ?. href } " .icon = "${ iconInfo } "> ${ this . docLink . text } </ cc- link>
140- </ div>
141- `
142- : '' }
141+ <div slot= "footer-right" >
142+ <cc- link .href = "${ activeTab . docLink . href } " .icon = "${ iconInfo } "> ${ activeTab . docLink . text } </ cc- link>
143+ </ div>
143144 </ cc- block>
144145 ` ;
145146 }
0 commit comments