Skip to content

Commit c6fd7a5

Browse files
authored
fix: added localized text shape for shellbar (#489)
* added localized text shape for shellbar * added description for shellbar
1 parent bbed4d5 commit c6fd7a5

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

src/Shellbar/Shellbar.js

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import classnames from 'classnames';
22
import Counter from '../Badge/Counter';
3+
import CustomPropTypes from '../utils/CustomPropTypes/CustomPropTypes';
34
import Icon from '../Icon/Icon';
45
import Identifier from '../Identifier/Identifier';
56
import Menu from '../Menu/Menu';
@@ -86,6 +87,7 @@ class Shellbar extends Component {
8687

8788
render() {
8889
const {
90+
localizedText,
8991
logo,
9092
logoSAP,
9193
productTitle,
@@ -192,7 +194,7 @@ class Shellbar extends Component {
192194
className={` fd-button--shell sap-icon--${action.glyph}`} >
193195
{action.notificationCount > 0 && (
194196
<span
195-
aria-label='Unread count'
197+
aria-label={localizedText.counterLabel}
196198
className='fd-counter fd-counter--notification' >
197199
{action.notificationCount}
198200
</span>
@@ -208,7 +210,7 @@ class Shellbar extends Component {
208210
onClick={action.callback} >
209211
{action.notificationCount > 0 && (
210212
<span
211-
aria-label='Unread count'
213+
aria-label={localizedText.counterLabel}
212214
className='fd-counter fd-counter--notification' >
213215
{action.notificationCount}
214216
</span>
@@ -227,8 +229,8 @@ class Shellbar extends Component {
227229
}
228230
control={
229231
<div className='fd-shellbar__action fd-shellbar__action--collapsible'>
230-
<button aria-label='Notifications' className=' fd-button--shell sap-icon--bell'>
231-
{(notifications.notificationCount > 0) && <span aria-label='Unread count' className='fd-counter fd-counter--notification'>
232+
<button aria-label={localizedText.notificationsButton} className=' fd-button--shell sap-icon--bell'>
233+
{(notifications.notificationCount > 0) && <span aria-label={localizedText.counterLabel} className='fd-counter fd-counter--notification'>
232234
{notifications.notificationCount}
233235
</span>}
234236
</button>
@@ -237,9 +239,9 @@ class Shellbar extends Component {
237239
placement='bottom-end' />
238240
) : (
239241
<div className='fd-shellbar__action fd-shellbar__action--collapsible'>
240-
<button aria-label='Notifications' className=' fd-button--shell sap-icon--bell'
242+
<button aria-label={localizedText.notificationsButton} className=' fd-button--shell sap-icon--bell'
241243
onClick={notifications.callback}>
242-
{(notifications.notificationCount > 0) && <span aria-label='Unread count' className='fd-counter fd-counter--notification'>
244+
{(notifications.notificationCount > 0) && <span aria-label={localizedText.counterLabel} className='fd-counter fd-counter--notification'>
243245
{notifications.notificationCount}
244246
</span>}
245247
</button>
@@ -294,7 +296,7 @@ class Shellbar extends Component {
294296
<div className='fd-shellbar-collapse--control' role='button'>
295297
<button className=' fd-button--shell sap-icon--overflow'>
296298
<span
297-
aria-label='Unread count'
299+
aria-label={localizedText.counterLabel}
298300
className='fd-counter fd-counter--notification'> {this.state.totalNotifications > 0 && this.state.totalNotifications} </span>
299301
</button>
300302
</div>
@@ -393,6 +395,10 @@ Shellbar.propTypes = {
393395
actions: PropTypes.array,
394396
className: PropTypes.string,
395397
copilot: PropTypes.bool,
398+
localizedText: CustomPropTypes.i18n({
399+
counterLabel: PropTypes.string,
400+
notificationsButton: PropTypes.string
401+
}),
396402
logo: PropTypes.object,
397403
logoSAP: PropTypes.bool,
398404
notifications: PropTypes.object,
@@ -406,11 +412,22 @@ Shellbar.propTypes = {
406412
subtitle: PropTypes.string
407413
};
408414

415+
Shellbar.defaultProps = {
416+
localizedText: {
417+
counterLabel: 'Unread count',
418+
notificationsButton: 'Notifications'
419+
}
420+
};
421+
409422
Shellbar.propDescriptions = {
410423
actions: 'Holds all product actions and links.',
411424
copilot: 'For use with applications that utilize CoPilot.',
412425
logo: 'Provide an img tag for a logo other than the SAP logo. One of the two props (`logo` or `logoSAP`) should be set.',
413426
logoSAP: 'Renders the SAP logo in the Shellbar. One of the two props (`logo` or `logoSAP`) should be set.',
427+
localizedText: {
428+
counterLabel: 'Aria-label for <span> element within the <button> element.',
429+
notificationsButton: 'Aria-label for <button> element.'
430+
},
414431
notifications: 'Information about pending notifications.',
415432
productMenu: 'Holds product titles and navigation.',
416433
productSwitcher: 'For navigating between products.',

0 commit comments

Comments
 (0)