Files
Shoppy/src/components/PrimaryButton.js
T
2026-07-01 10:33:17 +02:00

45 lines
985 B
JavaScript

import { Pressable, StyleSheet, Text } from 'react-native';
import { colors } from '../utils/constants';
export default function PrimaryButton({ label, onPress, disabled = false }) {
return (
<Pressable
accessibilityRole="button"
disabled={disabled}
onPress={onPress}
style={({ pressed }) => [
styles.button,
pressed ? styles.buttonPressed : null,
disabled ? styles.disabled : null
]}
>
<Text style={[styles.label, disabled ? styles.disabledLabel : null]}>{label}</Text>
</Pressable>
);
}
const styles = StyleSheet.create({
button: {
alignItems: 'center',
backgroundColor: colors.primary,
borderRadius: 8,
paddingHorizontal: 20,
paddingVertical: 14
},
buttonPressed: {
opacity: 0.82
},
label: {
color: colors.surface,
fontSize: 16,
fontWeight: '700'
},
disabled: {
backgroundColor: colors.border
},
disabledLabel: {
color: colors.muted
}
});