top-tran/toptran-app/src/components/Button.tsx
2026-05-03 01:16:25 -03:00

51 lines
1.1 KiB
TypeScript

import React from "react";
import {
StyleSheet,
Text,
TouchableOpacity,
TouchableOpacityProps,
} from "react-native";
import { COLORS, SPACING, BORDER_RADIUS } from "@/constants/theme";
type ButtonProps = TouchableOpacityProps & {
label: string;
disabled?: boolean;
};
export function Button({ label, disabled = false, ...rest }: ButtonProps) {
return (
<TouchableOpacity
style={[styles.container, disabled && styles.containerDisabled]}
activeOpacity={disabled ? 1 : 0.7}
disabled={disabled}
{...rest}
>
<Text style={[styles.label, disabled && styles.labelDisabled]}>
{label}
</Text>
</TouchableOpacity>
);
}
const styles = StyleSheet.create({
container: {
width: "100%",
height: 48,
backgroundColor: COLORS.buttonBackground,
borderRadius: BORDER_RADIUS.md,
alignItems: "center",
justifyContent: "center",
marginTop: SPACING.lg,
},
containerDisabled: {
backgroundColor: COLORS.buttonDisabledBackground,
},
label: {
color: COLORS.buttonText,
fontSize: 16,
fontWeight: "600",
},
labelDisabled: {
color: COLORS.buttonDisabledText,
},
});