From ba8b178c1373397bd753de98ed2cce13b31ac6ed Mon Sep 17 00:00:00 2001 From: hamed-musallam Date: Wed, 18 Jan 2023 17:11:58 +0100 Subject: [PATCH] stories: add table with context menu in the header --- stories/components/dropdown.stories.tsx | 83 ++++++++++++++++++++++++- 1 file changed, 82 insertions(+), 1 deletion(-) diff --git a/stories/components/dropdown.stories.tsx b/stories/components/dropdown.stories.tsx index e711bf68..fe352808 100644 --- a/stories/components/dropdown.stories.tsx +++ b/stories/components/dropdown.stories.tsx @@ -17,7 +17,12 @@ import { MenuItems, MenuOptions, } from '../../src/components/dropdown-menu/MenuItems'; -import { DropdownMenu } from '../../src/components/index'; +import { + DropdownMenu, + Table, + ValueRenderers, +} from '../../src/components/index'; +import data from '../data/table.json'; export default { title: 'Components / DropdownMenu', @@ -187,3 +192,79 @@ export function Complex() { ); } +export function TableWithHeaderDropDownMenu() { + const options = useMemo>(() => { + return [ + { label: 'Back', type: 'option', icon: }, + { + label: 'Forward', + type: 'option', + disabled: true, + icon: , + }, + { label: 'Refresh', type: 'option', icon: }, + { type: 'divider' }, + { label: 'Save as', type: 'option', icon: }, + { label: 'Print', type: 'option', icon: }, + { label: 'Cast media to device', type: 'option', icon: }, + { type: 'divider' }, + { + label: 'Send page to your devices', + type: 'option', + icon: , + }, + { + label: 'Create QR Code for this page', + type: 'option', + icon: , + }, + ]; + }, []); + + return ( + + + + + + + + + + + + + + {data + .slice(0, 2) + .map(({ id, name, rn, mw, em, isExpensive, color }) => ( + + + + + + + + + + ))} + +
+ ); +} + +function ColumnWithDropdownMenu({ + value, + options, +}: { + value: string; + options: MenuOptions; +}) { + return ( + + +
{value}
+
+ + ); +}