Skip to content

Commit

Permalink
Add example of new usage of instead
Browse files Browse the repository at this point in the history
  • Loading branch information
WithoutPants committed Aug 12, 2024
1 parent 8cb479e commit a2cb6ca
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkg/plugin/examples/react-component/src/testReact.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,15 @@
.scene-performer-popover .image-thumbnail {
margin: 1em;
}


.example-react-component-custom-overlay {
display: block;
font-weight: 900;
height: 100%;
opacity: 0.25;
position: absolute;
text-align: center;
top: 0;
width: 100%;
z-index: 8;
}
8 changes: 8 additions & 0 deletions pkg/plugin/examples/react-component/src/testReact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down

0 comments on commit a2cb6ca

Please sign in to comment.