From d8870f20620fc459ed284f652eb204366e6e317d Mon Sep 17 00:00:00 2001 From: Jonas Dellinger Date: Mon, 30 May 2022 22:23:13 +0200 Subject: Update lib, show example of router --- src/index.tsx | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src') diff --git a/src/index.tsx b/src/index.tsx index 8fd3a48..89de1b7 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -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 }> = ({}) => { + + + { + Router.CloseSideMenus(); + Router.Navigate("/decky-plugin-test"); + }} + > + Router + + ); }; +const DeckyPluginRouterTest: VFC = () => { + return ( +
+ Hello World! + Router.NavigateToStore()}> + Go to Store + +
+ ); +}; + export default definePlugin((serverApi: ServerAPI) => { + serverApi.routerHook.addRoute("/decky-plugin-test", DeckyPluginRouterTest, { + exact: true, + }); + return { title:
Example Plugin
, content: , icon: , + onDismount() { + serverApi.routerHook.removeRoute("/decky-plugin-test"); + }, }; }); -- cgit v1.2.3