about summary refs log tree commit diff
path: root/src/components/RadioGroup.tsx
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2024-05-16 16:57:07 +0100
committerGitHub <noreply@github.com>2024-05-16 16:57:07 +0100
commitda2bdf5d6f84ed726fb131f00fac5ef458be6f7e (patch)
tree5341b67ee20b414e045682f5aa3eaa7bf90e5152 /src/components/RadioGroup.tsx
parentd639c40e17fabbe9cb0f578eca838cf60c6463bb (diff)
downloadvoidsky-da2bdf5d6f84ed726fb131f00fac5ef458be6f7e.tar.zst
[🐴] use Toggle component in settings screen (#4048)
* use Toggle component

* nits + notifs sounds native only
Diffstat (limited to 'src/components/RadioGroup.tsx')
-rw-r--r--src/components/RadioGroup.tsx76
1 files changed, 0 insertions, 76 deletions
diff --git a/src/components/RadioGroup.tsx b/src/components/RadioGroup.tsx
deleted file mode 100644
index 010f65bc3..000000000
--- a/src/components/RadioGroup.tsx
+++ /dev/null
@@ -1,76 +0,0 @@
-import React from 'react'
-import {View, ViewProps} from 'react-native'
-
-import {atoms as a, useTheme} from '#/alf'
-import {Button} from './Button'
-import {Text} from './Typography'
-
-export function RadioGroup<T extends string | number>({
-  value,
-  onSelect,
-  items,
-  ...props
-}: ViewProps & {
-  value: T
-  onSelect: (value: T) => void
-  items: Array<{label: string; value: T}>
-}) {
-  return (
-    <View {...props}>
-      {items.map(item => (
-        <Button
-          label={item.label}
-          key={item.value}
-          variant="ghost"
-          color="secondary"
-          size="small"
-          onPress={() => onSelect(item.value)}
-          style={[a.justify_between, a.px_sm]}>
-          <Text style={a.text_md}>{item.label}</Text>
-          <RadioIcon selected={value === item.value} />
-        </Button>
-      ))}
-    </View>
-  )
-}
-
-function RadioIcon({selected}: {selected: boolean}) {
-  const t = useTheme()
-  return (
-    <View
-      style={[
-        {
-          width: 30,
-          height: 30,
-          borderWidth: 2,
-          borderColor: selected
-            ? t.palette.primary_500
-            : t.palette.contrast_200,
-        },
-        selected
-          ? {
-              backgroundColor:
-                t.name === 'light'
-                  ? t.palette.primary_100
-                  : t.palette.primary_900,
-            }
-          : t.atoms.bg,
-        a.align_center,
-        a.justify_center,
-        a.rounded_full,
-      ]}>
-      {selected && (
-        <View
-          style={[
-            {
-              width: 18,
-              height: 18,
-              backgroundColor: t.palette.primary_500,
-            },
-            a.rounded_full,
-          ]}
-        />
-      )}
-    </View>
-  )
-}