eletrotupi / tcc/ commit / 7d2b76a

frontend: add danger button variant

Pedro Lucas Porcellis porcellis@eletrotupi.com · 5 months ago 7d2b76a987098caa7e4b365e4d41c0bd0a7a2692 Browse files
Parents 5c34c8e
Changed files
1
Additions
+3
Deletions
-1
frontend/components/ui/Button.tsx
1 1
import React from 'react';
2 2
import {
3 3
  TouchableOpacity,
4 4
  Text,
5 5
  StyleSheet,
10 10
} from 'react-native';
11 11
import { useThemeColor } from '@/hooks/use-theme-color';
12 12

13 13
interface ButtonProps extends TouchableOpacityProps {
14 14
  title: string;
15 -
  variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'dashed';
15 +
  variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'dashed' | 'danger';
16 16
  size?: 'small' | 'medium' | 'large';
17 17
  loading?: boolean;
18 18
  disabled?: boolean;
19 19
  style?: ViewStyle;
20 20
  textStyle?: TextStyle;
43 43
    switch (variant) {
44 44
      case 'primary':
45 45
        return primaryColor;
46 46
      case 'secondary':
47 47
        return useThemeColor({ light: '#f3f4f6', dark: '#374151' }, 'background');
48 +
      case 'danger':
49 +
        return useThemeColor({}, 'danger');
48 50
      case 'outline':
49 51
      case 'ghost':
50 52
      case 'dashed':
51 53
        return 'transparent';
52 54
      default:
170 172
  },
171 173
  text: {
172 174
    fontWeight: '600',
173 175
  },
174 176
});