From 67426af3ef73e788d99b6d2e0c730c270daea273 Mon Sep 17 00:00:00 2001 From: AAGaming Date: Tue, 9 Aug 2022 21:52:03 -0400 Subject: Add api for showing toast notifications --- frontend/src/components/Toast.tsx | 54 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 frontend/src/components/Toast.tsx (limited to 'frontend/src/components/Toast.tsx') diff --git a/frontend/src/components/Toast.tsx b/frontend/src/components/Toast.tsx new file mode 100644 index 00000000..559c37c6 --- /dev/null +++ b/frontend/src/components/Toast.tsx @@ -0,0 +1,54 @@ +import { ToastData, findModule, joinClassNames } from 'decky-frontend-lib'; +import { FunctionComponent } from 'react'; + +interface ToastProps { + toast: { + data: ToastData; + nToastDurationMS: number; + }; +} + +const toastClasses = findModule((mod) => { + if (typeof mod !== 'object') return false; + + if (mod.ToastPlaceholder) { + return true; + } + + return false; +}); + +const templateClasses = findModule((mod) => { + if (typeof mod !== 'object') return false; + + if (mod.ShortTemplate) { + return true; + } + + return false; +}); + +const Toast: FunctionComponent = ({ toast }) => { + return ( +
+
+ {toast.data.logo &&
{toast.data.logo}
} +
+
+ {toast.data.icon &&
{toast.data.icon}
} +
{toast.data.title}
+
+
{toast.data.body}
+
+
+
+ ); +}; + +export default Toast; -- cgit v1.2.3