summaryrefslogtreecommitdiff
path: root/components/Collapsible.tsx
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-07-16 09:58:34 +0700
committerpolwex <polwex@sortug.com>2025-07-16 09:58:34 +0700
commitdc0ad21f0e857adb87d710dd0f2f9affd0a9cbc9 (patch)
tree3d556ead415654e03b511b007365bcdff6d612ee /components/Collapsible.tsx
parent697ed671f394cbd07ea9751fe17f262744d99a49 (diff)
kinda works
Diffstat (limited to 'components/Collapsible.tsx')
-rw-r--r--components/Collapsible.tsx33
1 files changed, 19 insertions, 14 deletions
diff --git a/components/Collapsible.tsx b/components/Collapsible.tsx
index 55bff2f..5820251 100644
--- a/components/Collapsible.tsx
+++ b/components/Collapsible.tsx
@@ -1,28 +1,33 @@
-import { PropsWithChildren, useState } from 'react';
-import { StyleSheet, TouchableOpacity } from 'react-native';
+"use client";
+import { PropsWithChildren, useState } from "react";
+import { StyleSheet, TouchableOpacity } from "react-native";
-import { ThemedText } from '@/components/ThemedText';
-import { ThemedView } from '@/components/ThemedView';
-import { IconSymbol } from '@/components/ui/IconSymbol';
-import { Colors } from '@/constants/Colors';
-import { useColorScheme } from '@/hooks/useColorScheme';
+import { ThemedText } from "@/components/ThemedText";
+import { ThemedView } from "@/components/ThemedView";
+import { IconSymbol } from "@/components/ui/IconSymbol";
+import { Colors } from "@/constants/Colors";
+import { useColorScheme } from "@/hooks/useColorScheme";
-export function Collapsible({ children, title }: PropsWithChildren & { title: string }) {
+export function Collapsible({
+ children,
+ title,
+}: PropsWithChildren & { title: string }) {
const [isOpen, setIsOpen] = useState(false);
- const theme = useColorScheme() ?? 'light';
+ const theme = useColorScheme() ?? "light";
return (
<ThemedView>
<TouchableOpacity
style={styles.heading}
onPress={() => setIsOpen((value) => !value)}
- activeOpacity={0.8}>
+ activeOpacity={0.8}
+ >
<IconSymbol
name="chevron.right"
size={18}
weight="medium"
- color={theme === 'light' ? Colors.light.icon : Colors.dark.icon}
- style={{ transform: [{ rotate: isOpen ? '90deg' : '0deg' }] }}
+ color={theme === "light" ? Colors.light.icon : Colors.dark.icon}
+ style={{ transform: [{ rotate: isOpen ? "90deg" : "0deg" }] }}
/>
<ThemedText type="defaultSemiBold">{title}</ThemedText>
@@ -34,8 +39,8 @@ export function Collapsible({ children, title }: PropsWithChildren & { title: st
const styles = StyleSheet.create({
heading: {
- flexDirection: 'row',
- alignItems: 'center',
+ flexDirection: "row",
+ alignItems: "center",
gap: 6,
},
content: {