managarten/games/figgos/apps/mobile/components/Button.tsx
Till-JS 05d074c57e 🔧 refactor(figgos): restructure to standard monorepo pattern
Migrate figgos from single Expo app to multi-app monorepo structure:
- Move mobile app to apps/mobile/
- Add apps/web/ (SvelteKit) and apps/backend/ (NestJS) scaffolds
- Add packages/shared/ for shared types and constants
- Update root package.json with new dev commands
- Temporarily skip type-check (run pnpm install first)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 17:27:15 +01:00

45 lines
1.2 KiB
TypeScript

import { forwardRef } from 'react';
import { Text, Pressable, View } from 'react-native';
import { useState } from 'react';
import { useTheme } from '~/utils/ThemeContext';
type ButtonProps = {
title: string;
onPress?: () => void;
disabled?: boolean;
className?: string;
style?: any;
};
export const Button = forwardRef<View, ButtonProps>(
({ title, onPress, disabled, className, style, ...props }, ref) => {
const [isHovered, setIsHovered] = useState(false);
const { theme } = useTheme();
return (
<Pressable
ref={ref}
onPress={onPress}
disabled={disabled}
onHoverIn={() => setIsHovered(true)}
onHoverOut={() => setIsHovered(false)}
className={`items-center rounded-[28px] shadow-md p-4 transition-colors ${isHovered ? 'opacity-90' : ''} ${disabled ? 'opacity-70' : ''} ${className || ''}`}
style={[
{
backgroundColor: disabled
? '#9ca3af'
: isHovered
? theme.colors.secondary
: theme.colors.primary,
},
style,
]}
{...props}
>
<Text className="text-white text-lg font-semibold text-center">{title}</Text>
</Pressable>
);
}
);
// Styles werden jetzt direkt im Component mit theme.colors verwendet