From 3ffff0a16a84b3f4c62caf4dcb6e9416f4467fee Mon Sep 17 00:00:00 2001 From: Birk Johansson Date: Sun, 22 Oct 2023 12:25:26 +0300 Subject: [PATCH] feat(list): implement more menu --- src/components/sectionList/SectionListRow.tsx | 58 ++++++++++-------- .../listActions/SectionListActions.module.css | 12 ++++ .../listActions/SectionListActions.tsx | 60 +++++++++++++++++++ 3 files changed, 105 insertions(+), 25 deletions(-) create mode 100644 src/components/sectionList/listActions/SectionListActions.module.css create mode 100644 src/components/sectionList/listActions/SectionListActions.tsx diff --git a/src/components/sectionList/SectionListRow.tsx b/src/components/sectionList/SectionListRow.tsx index af55562b..befc83cb 100644 --- a/src/components/sectionList/SectionListRow.tsx +++ b/src/components/sectionList/SectionListRow.tsx @@ -5,6 +5,11 @@ import React from 'react' import { Link } from 'react-router-dom' import { CheckBoxOnChangeObject } from '../../types' import { IdentifiableObject, GistModel } from '../../types/models' +import { + ListActions, + ActionEdit, + ActionMore, +} from './listActions/SectionListActions' import css from './SectionList.module.css' import { SelectedColumns, SelectedColumn } from './types' @@ -51,35 +56,38 @@ export function SectionListRow({ ))} - + + + + ) } -const ListActions = ({ modelId }: { modelId: string }) => { - return ( -
- - -
- ) -} +// const ListActions = ({ modelId }: { modelId: string }) => { +// return ( +//
+// +// +//
+// ) +// } -const ActionEdit = ({ modelId }: { modelId: string }) => { - return ( - - - - ) -} +// const ActionEdit = ({ modelId }: { modelId: string }) => { +// return ( +// +// +// +// ) +// } -const ActionMore = () => { - return ( - - ) -} +// const ActionMore = () => { +// return ( +// +// ) +// } diff --git a/src/components/sectionList/listActions/SectionListActions.module.css b/src/components/sectionList/listActions/SectionListActions.module.css new file mode 100644 index 00000000..dd09368d --- /dev/null +++ b/src/components/sectionList/listActions/SectionListActions.module.css @@ -0,0 +1,12 @@ +.listActions { + display: flex; + gap: var(--spacers-dp8); +} + +.listActions button { + padding: 0 2px !important; +} + +.actionMorePopover { + box-shadow: none !important; +} diff --git a/src/components/sectionList/listActions/SectionListActions.tsx b/src/components/sectionList/listActions/SectionListActions.tsx new file mode 100644 index 00000000..be2e27f7 --- /dev/null +++ b/src/components/sectionList/listActions/SectionListActions.tsx @@ -0,0 +1,60 @@ +import { + Button, + FlyoutMenu, + IconEdit16, + IconEdit24, + IconMore16, + IconMore24, + MenuItem, + Popover, +} from '@dhis2/ui' +import React, { useRef, useState } from 'react' +import { Link } from 'react-router-dom' +import css from './SectionListActions.module.css' + +export const ListActions = ({ children }: React.PropsWithChildren) => { + return
{children}
+} + +export const ActionEdit = ({ modelId }: { modelId: string }) => { + return ( + + + + ) +} + +export const ActionMore = () => { + const [open, setOpen] = useState(false) + const ref = useRef(null) + return ( +
+ +
+ ) +}