From 01b3c8be6a3cd143a044c826d7f79ed2128cdd3b Mon Sep 17 00:00:00 2001
From: sowgro <tpoke.ferrari@gmail.com>
Date: Sun, 3 Nov 2024 00:19:58 -0400
Subject: Start making settings work

---
 extension/src/RadioButtonGroup.tsx | 53 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 extension/src/RadioButtonGroup.tsx

(limited to 'extension/src/RadioButtonGroup.tsx')

diff --git a/extension/src/RadioButtonGroup.tsx b/extension/src/RadioButtonGroup.tsx
new file mode 100644
index 0000000..14f348d
--- /dev/null
+++ b/extension/src/RadioButtonGroup.tsx
@@ -0,0 +1,53 @@
+import React, {useId, useState} from "react";
+
+interface radioEntry {
+    label: string,
+    data: any,
+}
+
+interface IProps {
+    groupLabel: string,
+    items: radioEntry[],
+    defaultData: any
+}
+
+function RadioButtonGroup(props: IProps) {
+    const [selected, setSelected] = useState(props.defaultData);
+
+    return (
+        <>
+            <h3>{props.groupLabel}</h3>
+            <div className="radio-group">
+                { props.items.map((item) => (
+                    <label>
+                        <input
+                            type="radio"
+                            name={useId()}
+                            value={item.data}
+                            checked={item.data === selected}
+                            onChange={e => setSelected(e.target.value)}
+                        />
+                        {item.label}
+                    </label>
+                )) }
+            </div>
+            <span>currently selected: {selected}</span>
+        </>
+    )
+}
+
+export default RadioButtonGroup
+
+//     <h3>Sort</h3>
+//     <label>
+//         <input type="radio" name="sort"/>
+//         From bookmarks
+//     </label>
+//     <label>
+//         <input type="radio" name="sort"/>
+//         Alphabetical
+//     </label>
+//     <label>
+//         <input type="radio" name="sort"/>
+//         Frequency
+//     </label>
\ No newline at end of file
-- 
cgit v1.2.3

