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