Skip to content

Commit

Permalink
Add OverridableContext.Provider to CreatibutorsModal
Browse files Browse the repository at this point in the history
  • Loading branch information
mkloeppe committed Jul 3, 2024
1 parent e64dd0b commit 46ab124
Showing 1 changed file with 20 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import { CreatibutorsFieldItem } from "./CreatibutorsFieldItem";
import { CREATIBUTOR_TYPE } from "./type";
import { sortOptions } from "../../utils";
import { i18next } from "@translations/invenio_rdm_records/i18next";
import { OverridableContext, overrideStore } from "react-overridable";

const overriddenComponents = overrideStore.getAll();

const creatibutorNameDisplay = (value) => {
const creatibutorType = _get(value, "person_or_org.type", CREATIBUTOR_TYPE.PERSON);
Expand Down Expand Up @@ -107,21 +110,23 @@ class CreatibutorsFieldForm extends Component {
);
})}
</List>
<CreatibutorsModal
onCreatibutorChange={this.handleOnContributorChange}
action="add"
addLabel={modal.addLabel}
editLabel={modal.editLabel}
roleOptions={sortOptions(roleOptions)}
schema={schema}
autocompleteNames={autocompleteNames}
trigger={
<Button type="button" icon labelPosition="left">
<Icon name="add" />
{addButtonLabel}
</Button>
}
/>
<OverridableContext.Provider value={overriddenComponents}>
<CreatibutorsModal
onCreatibutorChange={this.handleOnContributorChange}
action="add"
addLabel={modal.addLabel}
editLabel={modal.editLabel}
roleOptions={sortOptions(roleOptions)}
schema={schema}
autocompleteNames={autocompleteNames}
trigger={
<Button type="button" icon labelPosition="left">
<Icon name="add" />
{addButtonLabel}
</Button>
}
/>
</OverridableContext.Provider>
{creatibutorsError && typeof creatibutorsError == "string" && (
<Label pointing="left" prompt>
{creatibutorsError}
Expand Down

0 comments on commit 46ab124

Please sign in to comment.