diff --git a/apps/client/src/widgets/bulk_actions/BulkAction.tsx b/apps/client/src/widgets/bulk_actions/BulkAction.tsx index 3389d59f5..8b562d0f0 100644 --- a/apps/client/src/widgets/bulk_actions/BulkAction.tsx +++ b/apps/client/src/widgets/bulk_actions/BulkAction.tsx @@ -1,6 +1,7 @@ import { ComponentChildren } from "preact"; import { memo } from "preact/compat"; import AbstractBulkAction from "./abstract_bulk_action"; +import HelpRemoveButtons from "../react/HelpRemoveButtons"; interface BulkActionProps { label: string | ComponentChildren; @@ -24,19 +25,11 @@ const BulkAction = memo(({ label, children, helpText, bulkAction }: BulkActionPr {children} - - {helpText &&
- -
- {helpText} -
-
} - - bulkAction?.deleteAction()} - /> - + bulkAction?.deleteAction()} + /> ); }); diff --git a/apps/client/src/widgets/react/HelpRemoveButtons.tsx b/apps/client/src/widgets/react/HelpRemoveButtons.tsx new file mode 100644 index 000000000..7eda18b97 --- /dev/null +++ b/apps/client/src/widgets/react/HelpRemoveButtons.tsx @@ -0,0 +1,30 @@ +import type { ComponentChildren } from "preact"; +import ActionButton from "./ActionButton"; +import Dropdown from "./Dropdown"; + +interface HelpRemoveButtonsProps { + help?: ComponentChildren; + removeText?: string; + onRemove?: () => void; +} + +export default function HelpRemoveButtons({ help, removeText, onRemove }: HelpRemoveButtonsProps) { + return ( + + {help && <> + {help} + {" "} + } + + + ); +} \ No newline at end of file diff --git a/apps/client/src/widgets/ribbon/SearchDefinitionOptions.tsx b/apps/client/src/widgets/ribbon/SearchDefinitionOptions.tsx index 45d812844..6f98c63e1 100644 --- a/apps/client/src/widgets/ribbon/SearchDefinitionOptions.tsx +++ b/apps/client/src/widgets/ribbon/SearchDefinitionOptions.tsx @@ -1,5 +1,3 @@ -import Dropdown from "../react/Dropdown"; -import ActionButton from "../react/ActionButton"; import FormTextArea from "../react/FormTextArea"; import NoteAutocomplete from "../react/NoteAutocomplete"; import FormSelect from "../react/FormSelect"; @@ -14,6 +12,7 @@ import { t } from "../../services/i18n"; import { useEffect, useMemo, useRef } from "preact/hooks"; import appContext from "../../components/app_context"; import server from "../../services/server"; +import HelpRemoveButtons from "../react/HelpRemoveButtons"; export interface SearchOption { attributeName: string; @@ -122,25 +121,18 @@ function SearchOption({ note, title, titleIcon, children, help, attributeName, a {title} {children} - - {help && <> - {help} - {" "} - } - { - removeOwnedAttributesByNameOrType(note, attributeType, attributeName); - if (additionalAttributesToDelete) { - for (const { type, name } of additionalAttributesToDelete) { - removeOwnedAttributesByNameOrType(note, type, name); - } + { + removeOwnedAttributesByNameOrType(note, attributeType, attributeName); + if (additionalAttributesToDelete) { + for (const { type, name } of additionalAttributesToDelete) { + removeOwnedAttributesByNameOrType(note, type, name); } - }} - /> - + } + }} + /> ) }