mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
UI nested instead (#5125)
* Support multiple calls to PluginApi.patch.instead for a component. Allow calling the original/chained function from the hook function. * Add example of new usage of instead * Update documentation
This commit is contained in:
@@ -132,10 +132,18 @@ interface IPluginApi {
|
||||
);
|
||||
}
|
||||
|
||||
function Overlays() {
|
||||
return <span className="example-react-component-custom-overlay">Custom overlay</span>;
|
||||
}
|
||||
|
||||
PluginApi.patch.instead("SceneCard.Details", function (props: any, _: any, original: any) {
|
||||
return <SceneDetails {...props} />;
|
||||
});
|
||||
|
||||
PluginApi.patch.instead("SceneCard.Overlays", function (props: any, _: any, original: (props: any) => any) {
|
||||
return <><Overlays />{original({...props})}</>;
|
||||
});
|
||||
|
||||
const TestPage: React.FC = () => {
|
||||
const componentsLoading = PluginApi.hooks.useLoadComponents([PluginApi.loadableComponents.SceneCard]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user