@@ -7,6 +7,7 @@ import type {
77 NavigationLayoutDomRef ,
88 ResponsivePopoverDomRef ,
99 ShellBarPropTypes ,
10+ ShellBarSearchPropTypes ,
1011 ToggleButtonPropTypes ,
1112 UserMenuDomRef ,
1213} from '@ui5/webcomponents-react' ;
@@ -41,6 +42,7 @@ export function NLShellBar(props: NLShellBarProps) {
4142 const [ assistantBtnPressed , setAssistantBtnPressed ] = useState ( false ) ;
4243 const [ notificationsPopoverOpen , setNotificationsPopoverOpen ] = useState ( false ) ;
4344 const [ userMenuOpen , setUserMenuOpen ] = useState ( false ) ;
45+ const [ scopeData , setScopeData ] = useState ( _scopeData ) ;
4446
4547 const handleAssistantClick : ToggleButtonPropTypes [ 'onClick' ] = ( e ) => {
4648 setAssistantBtnPressed ( e . currentTarget ! . pressed ) ;
@@ -68,6 +70,11 @@ export function NLShellBar(props: NLShellBarProps) {
6870 setUserMenuOpen ( true ) ;
6971 } ;
7072
73+ const handleSearchScopeChange : ShellBarSearchPropTypes [ 'onScopeChange' ] = ( e ) => {
74+ const scopeText = e . detail . scope ?. text === 'All' ? '' : e . detail . scope ?. text ?. toLowerCase ( ) ;
75+ setScopeData ( _scopeData . filter ( ( item ) => ! scopeText || item . scope === scopeText ) ) ;
76+ } ;
77+
7178 return (
7279 < >
7380 < ShellBar
@@ -112,6 +119,7 @@ export function NLShellBar(props: NLShellBarProps) {
112119 id = "search-scope"
113120 showClearIcon
114121 placeholder = "Search Apps, Products"
122+ onScopeChange = { handleSearchScopeChange }
115123 scopes = {
116124 < >
117125 < SearchScope text = "All" selected />
@@ -146,7 +154,7 @@ export function NLShellBar(props: NLShellBarProps) {
146154
147155NLShellBar . displayName = 'NLShellBar' ;
148156
149- const scopeData = [
157+ const _scopeData = [
150158 { name : 'Laptop' , scope : 'products' } ,
151159 { name : 'Leave Requests' , scope : 'apps' } ,
152160 { name : 'Log work' , scope : 'apps' } ,
0 commit comments