From eb7bd96a92c351080bdee8004334bd93d81b41d9 Mon Sep 17 00:00:00 2001
From: xXJSONDeruloXx <danielhimebauch@gmail.com>
Date: Tue, 21 Jan 2025 19:57:10 -0500
Subject: feat: add dropdown menu

---
 src/index.tsx | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

(limited to 'src/index.tsx')

diff --git a/src/index.tsx b/src/index.tsx
index 16cd6cb..15fe792 100755
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -3,7 +3,9 @@ import {
   PanelSection,
   PanelSectionRow,
   Navigation,
-  staticClasses
+  staticClasses,
+  Dropdown,
+  DropdownOption
 } from "@decky/ui";
 import {
   addEventListener,
@@ -28,8 +30,15 @@ const add = callable<[first: number, second: number], number>("add");
 // It starts a (python) timer which eventually emits the event 'timer_event'
 const startTimer = callable<[], void>("start_timer");
 
+const dropdownOptions: DropdownOption[] = [
+  { label: "1", data: 1 },
+  { label: "2", data: 2 },
+  { label: "3", data: 3 },
+];
+
 function Content() {
   const [result, setResult] = useState<number | undefined>();
+  const [selectedOption, setSelectedOption] = useState<number | undefined>();
 
   const onClick = async () => {
     const result = await add(Math.random(), Math.random());
@@ -54,6 +63,13 @@ function Content() {
           {"Start Python timer"}
         </ButtonItem>
       </PanelSectionRow>
+      <PanelSectionRow>
+        <Dropdown
+          rgOptions={dropdownOptions}
+          selectedOption={selectedOption}
+          onChange={(option) => setSelectedOption(option.data)}
+        />
+      </PanelSectionRow>
 
       {/* <PanelSectionRow>
         <div style={{ display: "flex", justifyContent: "center" }}>
-- 
cgit v1.2.3

