fix: pg db timezone, dialog mount child when visible, show non expired link and more

This commit is contained in:
Max Koon
2025-11-22 11:14:29 -05:00
parent 0edbf53db3
commit c4bb0d3304
15 changed files with 199 additions and 185 deletions

View File

@@ -1,3 +1,4 @@
import { useKeyboard } from "../src/useKeyboard";
import type { ReactNode } from "react";
import { Text, Pressable } from "react-native";
@@ -5,6 +6,7 @@ export interface ButtonProps {
children: ReactNode;
onPress?: () => void;
variant?: 'default' | 'secondary' | 'destructive';
shortcut?: string;
}
const STYLES: Record<NonNullable<ButtonProps['variant']>, { backgroundColor: string, color: string }> = {
@@ -13,10 +15,15 @@ const STYLES: Record<NonNullable<ButtonProps['variant']>, { backgroundColor: str
destructive: { backgroundColor: 'red', color: 'white' },
};
export function Button({ children, variant, onPress }: ButtonProps) {
export function Button({ children, variant, onPress, shortcut }: ButtonProps) {
const { backgroundColor, color } = STYLES[variant || "default"];
useKeyboard((key) => {
if (!shortcut || !onPress) return;
if (key.name == shortcut) onPress();
});
return <Pressable onPress={onPress} style={{ backgroundColor }}>
<Text style={{ fontFamily: 'mono', color }}> {children} </Text>
<Text style={{ fontFamily: 'mono', color }}> {children}{shortcut && ` (${shortcut})`} </Text>
</Pressable>
}