-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
98 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
19 changes: 19 additions & 0 deletions
19
vuu-ui/packages/vuu-filters/src/filter-bar/FilterBarMenu.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { PopupMenu } from "@finos/vuu-popups"; | ||
import { useFilterBarMenu } from "./useFilterBarMenu"; | ||
|
||
export const FilterBarMenu = () => { | ||
const classBase = "vuuFilterBarMenu"; | ||
|
||
const { menuBuilder, menuActionHandler } = useFilterBarMenu(); | ||
|
||
return ( | ||
<div className={classBase}> | ||
<PopupMenu | ||
icon="tune" | ||
menuBuilder={menuBuilder} | ||
menuActionHandler={menuActionHandler} | ||
tabIndex={-1} | ||
/> | ||
</div> | ||
); | ||
}; |
33 changes: 33 additions & 0 deletions
33
vuu-ui/packages/vuu-filters/src/filter-bar/useFilterBarMenu.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { useCallback, useMemo } from "react"; | ||
import { | ||
ContextMenuItemDescriptor, | ||
MenuActionHandler, | ||
MenuBuilder, | ||
} from "@finos/vuu-data-types"; | ||
import { MenuActionClosePopup } from "@finos/vuu-popups"; | ||
|
||
export const useFilterBarMenu = () => { | ||
const menuBuilder = useCallback<MenuBuilder>(() => { | ||
return [ | ||
{ | ||
label: `You have no saved filters for this table`, | ||
action: `no-action`, | ||
} as ContextMenuItemDescriptor, | ||
]; | ||
}, []); | ||
|
||
const menuActionHandler = useMemo<MenuActionHandler>( | ||
() => (action: MenuActionClosePopup) => { | ||
console.log(`invoke menuId `, { | ||
action, | ||
}); | ||
return false; | ||
}, | ||
[] | ||
); | ||
|
||
return { | ||
menuBuilder, | ||
menuActionHandler, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters