Skip to content

Commit 4d2a764

Browse files
authored
refactor(ui5-shellbar): extract profile btn as HBS partial (#4342)
The stakeholders can't provide own 'title' for the ShellBar's profile button. We show "profile", which is not what the stakeholders need. As currently, it's not possible to replace a specific text in the i18n bundle, we would need to provide either a HBS template hook, or an API to allow developers set their own text. The template hook is the simplest solution without any change in the APIs. Extract the profile button mark up as Handlebars partial to allow custom component developers to overwrite the Handlebars partial and change the profile button "title" to the desired one. Fixes: #4009
1 parent 2745bbc commit 4d2a764

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

packages/fiori/src/ShellBar.hbs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -155,20 +155,7 @@
155155
></ui5-button>
156156

157157
{{#if hasProfile}}
158-
<ui5-button
159-
profile-btn
160-
id="{{this._id}}-item-3"
161-
@click={{_handleProfilePress}}
162-
style="{{styles.items.profile}}"
163-
title="{{_profileText}}"
164-
._buttonAccInfo="{{accInfo.profile}}"
165-
class="ui5-shellbar-button ui5-shellbar-image-button"
166-
data-ui5-stable="profile"
167-
>
168-
<slot
169-
name="profile"
170-
></slot>
171-
</ui5-button>
158+
{{> profileButton}}
172159
{{/if}}
173160

174161
{{#if showProductSwitch}}
@@ -188,6 +175,21 @@
188175
</div>
189176
</div>
190177

178+
{{#*inline "profileButton"}}
179+
<ui5-button
180+
profile-btn
181+
id="{{this._id}}-item-3"
182+
@click={{_handleProfilePress}}
183+
style="{{styles.items.profile}}"
184+
title="{{_profileText}}"
185+
._buttonAccInfo="{{accInfo.profile}}"
186+
class="ui5-shellbar-button ui5-shellbar-image-button"
187+
data-ui5-stable="profile"
188+
>
189+
<slot name="profile"></slot>
190+
</ui5-button>
191+
{{/inline}}
192+
191193
{{#*inline "coPilot"}}
192194
<svg @click="{{_coPilotClick}}" focusable="false" width="44" role="presentation" aria-hidden="true" height="44" viewBox="-150 -150 300 300" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="ui5-shellbar-coPilot">
193195
<defs>

0 commit comments

Comments
 (0)