1+ import NavigationLayoutMode from '@ui5/webcomponents-fiori/dist/types/NavigationLayoutMode.js' ;
2+ import da2Icon from '@ui5/webcomponents-icons/dist/da-2.js' ;
3+ import daIcon from '@ui5/webcomponents-icons/dist/da.js' ;
4+ import menu2Icon from '@ui5/webcomponents-icons/dist/menu2.js' ;
5+ import sysHelpIcon from '@ui5/webcomponents-icons/dist/sys-help.js' ;
16import {
27 Avatar ,
38 Button ,
49 NavigationLayoutDomRef ,
510 ResponsivePopoverDomRef ,
11+ SearchItem ,
612 SearchScope ,
713 ShellBar ,
814 ShellBarItem ,
915 ShellBarPropTypes ,
1016 ShellBarSearch ,
17+ ShellBarSearchPropTypes ,
1118 ShellBarSpacer ,
1219 Tag ,
1320 Text ,
1421 ToggleButton ,
1522 ToggleButtonPropTypes ,
23+ UserMenuDomRef ,
1624} from '@ui5/webcomponents-react' ;
17- import globeIcon from '@ui5/webcomponents-icons/dist/globe.js' ;
18- import collaborateIcon from '@ui5/webcomponents-icons/dist/collaborate.js' ;
19- import officialServiceIcon from '@ui5/webcomponents-icons/dist/official-service.js' ;
20- import privateIcon from '@ui5/webcomponents-icons/dist/private.js' ;
21- import acceleratedIcon from '@ui5/webcomponents-icons/dist/accelerated.js' ;
22- import daIcon from '@ui5/webcomponents-icons/dist/da.js' ;
23- import da2Icon from '@ui5/webcomponents-icons/dist/da-2.js' ;
24- import menu2Icon from '@ui5/webcomponents-icons/dist/menu2.js' ;
25- import settingsIcon from '@ui5/webcomponents-icons/dist/settings.js' ;
26- import sysHelpIcon from '@ui5/webcomponents-icons/dist/sys-help.js' ;
27- import homeIcon from '@ui5/webcomponents-icons/dist/home.js' ;
28- import favoriteListIcon from '@ui5/webcomponents-icons/dist/favorite-list.js' ;
29- import accountIcon from '@ui5/webcomponents-icons/dist/account.js' ;
30- import businessByDesignIcon from '@ui5/webcomponents-icons/dist/business-by-design.js' ;
31- import crmSalesIcon from '@ui5/webcomponents-icons/dist/crm-sales.js' ;
32- import s4hanaIcon from '@ui5/webcomponents-icons/dist/s4hana.js' ;
33- import addIcon from '@ui5/webcomponents-icons/dist/add.js' ;
34- import managerInsightIcon from '@ui5/webcomponents-icons/dist/manager-insight.js' ;
35- import actionSettingsIcon from '@ui5/webcomponents-icons/dist/action-settings.js' ;
36- import sortIcon from '@ui5/webcomponents-icons/dist/sort.js' ;
37- import messageInformationIcon from '@ui5/webcomponents-icons/dist/message-information.js' ;
38- import expenseReportIcon from '@ui5/webcomponents-icons/dist/expense-report.js' ;
39- import userSettingsIcon from '@ui5/webcomponents-icons/dist/user-settings.js' ;
40- import personPlaceholderIcon from '@ui5/webcomponents-icons/dist/person-placeholder.js' ;
41- import paletteIcon from '@ui5/webcomponents-icons/dist/palette.js' ;
42- import iphoneIcon from '@ui5/webcomponents-icons/dist/iphone.js' ;
43- import qrCodeIcon from '@ui5/webcomponents-icons/dist/qr-code.js' ;
44- import bellIcon from '@ui5/webcomponents-icons/dist/bell.js' ;
45- import resetIcon from '@ui5/webcomponents-icons/dist/reset.js' ;
4625import { Dispatch , SetStateAction , useRef , useState } from 'react' ;
47- import NavigationLayoutMode from '@ui5/webcomponents-fiori/dist/types/NavigationLayoutMode.js ' ;
26+ import { NLUserMenu } from './NLUserMenu.tsx ' ;
4827import { NotificationsPopover } from './NotificationsPopover.tsx' ;
4928
5029interface NLShellBarProps extends ShellBarPropTypes {
@@ -54,8 +33,10 @@ interface NLShellBarProps extends ShellBarPropTypes {
5433export function NLShellBar ( props : NLShellBarProps ) {
5534 const { setMode, ...rest } = props ;
5635 const notificationsPopoverRef = useRef < ResponsivePopoverDomRef > ( null ) ;
36+ const userMenuRef = useRef < UserMenuDomRef > ( null ) ;
5737 const [ assistantBtnPressed , setAssistantBtnPressed ] = useState ( false ) ;
5838 const [ notificationsPopoverOpen , setNotificationsPopoverOpen ] = useState ( false ) ;
39+ const [ userMenuOpen , setUserMenuOpen ] = useState ( false ) ;
5940
6041 const handleAssistantClick : ToggleButtonPropTypes [ 'onClick' ] = ( e ) => {
6142 setAssistantBtnPressed ( e . currentTarget ! . pressed ) ;
@@ -78,6 +59,13 @@ export function NLShellBar(props: NLShellBarProps) {
7859 setNotificationsPopoverOpen ( false ) ;
7960 } ;
8061
62+ const handleProfileClick : ShellBarPropTypes [ 'onProfileClick' ] = ( e ) => {
63+ userMenuRef . current ! . opener = e . detail . targetRef ;
64+ setUserMenuOpen ( true ) ;
65+ } ;
66+
67+ const handleSearchScopeChange : ShellBarSearchPropTypes [ 'onScopeChange' ] = ( e ) => { } ;
68+
8169 return (
8270 < >
8371 < ShellBar
@@ -88,6 +76,7 @@ export function NLShellBar(props: NLShellBarProps) {
8876 showNotifications
8977 showProductSwitch
9078 onNotificationsClick = { handleNotificationsClick }
79+ onProfileClick = { handleProfileClick }
9180 startButton = {
9281 < Button
9382 id = "menu-button"
@@ -97,13 +86,7 @@ export function NLShellBar(props: NLShellBarProps) {
9786 onClick = { handleMenuBtnClick }
9887 />
9988 }
100- logo = {
101- < img
102- //todo: sap logo
103- src = "https://raw.githubusercontent.com/SAP/ui5-webcomponents-react/main/assets/ui5-logo.svg"
104- alt = "SAP Logo"
105- />
106- }
89+ logo = { < img src = "sap-logo.svg" alt = "SAP Logo" /> }
10790 content = {
10891 < >
10992 < Tag design = "Set2" colorScheme = "7" data-hide-order = "2" >
@@ -123,16 +106,27 @@ export function NLShellBar(props: NLShellBarProps) {
123106 />
124107 }
125108 searchField = {
126- < ShellBarSearch id = "search-scope" showClearIcon placeholder = "Search Apps, Products" >
127- < SearchScope text = "All" selected />
128- < SearchScope text = "Apps" />
129- < SearchScope text = "Products" />
109+ < ShellBarSearch
110+ id = "search-scope"
111+ showClearIcon
112+ placeholder = "Search Apps, Products"
113+ onScopeChange = { handleSearchScopeChange }
114+ scopes = {
115+ < >
116+ < SearchScope text = "All" selected />
117+ < SearchScope text = "Apps" />
118+ < SearchScope text = "Products" />
119+ </ >
120+ }
121+ >
122+ { scopeData . map ( ( item ) => (
123+ < SearchItem key = { item . name } text = { item . name } scopeName = { item . scope } />
124+ ) ) }
130125 </ ShellBarSearch >
131126 }
132127 profile = {
133128 < Avatar >
134- { /*todo person placeholder*/ }
135- < img src = "../assets/images/avatars/man_avatar_3.png" alt = "User Avatar" />
129+ < img src = "avatar.png" alt = "User Avatar" />
136130 </ Avatar >
137131 }
138132 >
@@ -144,8 +138,18 @@ export function NLShellBar(props: NLShellBarProps) {
144138 ref = { notificationsPopoverRef }
145139 closeNotificationsPopover = { closeNotificationsPopover }
146140 />
141+ < NLUserMenu open = { userMenuOpen } ref = { userMenuRef } setOpen = { setUserMenuOpen } />
147142 </ >
148143 ) ;
149144}
150145
151146NLShellBar . displayName = 'NLShellBar' ;
147+
148+ const scopeData = [
149+ { name : 'Laptop' , scope : 'products' } ,
150+ { name : 'Leave Requests' , scope : 'apps' } ,
151+ { name : 'Log work' , scope : 'apps' } ,
152+ { name : 'Manage Products' , scope : 'apps' } ,
153+ { name : 'Mobile Phones' , scope : 'products' } ,
154+ { name : 'Tablet' , scope : 'products' } ,
155+ ] ;
0 commit comments