mirror of
https://github.com/SteamDeckHomebrew/decky-plugin-template.git
synced 2025-11-01 15:52:25 -05:00
Update lib, show example of router
This commit is contained in:
parent
8232080649
commit
d8870f2062
3 changed files with 59 additions and 19 deletions
|
|
@ -1,10 +1,12 @@
|
|||
import {
|
||||
ButtonItem,
|
||||
definePlugin,
|
||||
DialogButton,
|
||||
Menu,
|
||||
MenuItem,
|
||||
PanelSection,
|
||||
PanelSectionRow,
|
||||
Router,
|
||||
ServerAPI,
|
||||
showModal,
|
||||
staticClasses,
|
||||
|
|
@ -60,14 +62,44 @@ const Content: VFC<{ serverAPI: ServerAPI }> = ({}) => {
|
|||
<img src={logo} />
|
||||
</div>
|
||||
</PanelSectionRow>
|
||||
|
||||
<PanelSectionRow>
|
||||
<ButtonItem
|
||||
layout="below"
|
||||
onClick={() => {
|
||||
Router.CloseSideMenus();
|
||||
Router.Navigate("/decky-plugin-test");
|
||||
}}
|
||||
>
|
||||
Router
|
||||
</ButtonItem>
|
||||
</PanelSectionRow>
|
||||
</PanelSection>
|
||||
);
|
||||
};
|
||||
|
||||
const DeckyPluginRouterTest: VFC = () => {
|
||||
return (
|
||||
<div style={{ marginTop: "50px", color: "white" }}>
|
||||
Hello World!
|
||||
<DialogButton onClick={() => Router.NavigateToStore()}>
|
||||
Go to Store
|
||||
</DialogButton>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default definePlugin((serverApi: ServerAPI) => {
|
||||
serverApi.routerHook.addRoute("/decky-plugin-test", DeckyPluginRouterTest, {
|
||||
exact: true,
|
||||
});
|
||||
|
||||
return {
|
||||
title: <div className={staticClasses.Title}>Example Plugin</div>,
|
||||
content: <Content serverAPI={serverApi} />,
|
||||
icon: <FaShip />,
|
||||
onDismount() {
|
||||
serverApi.routerHook.removeRoute("/decky-plugin-test");
|
||||
},
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue