All files / molecules/DialogBox/mobile utils.tsx

50% Statements 4/8
20% Branches 1/5
100% Functions 1/1
50% Lines 4/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58        5x                                                                             15x   15x                   15x    
import { colors } from '@sb/styles/colors';
import { ThemeColors } from '@sb/ui/components/Themes/Themes';
import { NativeDialogBoxVariant } from './DialogBox.native.types';
 
export const ModalShadows: Record<NativeDialogBoxVariant, object> = {
  info: {
    shadowColor: colors.light.colorElement_Nuance_Color,
    shadowOffset: { width: 2, height: 5 },
    shadowRadius: 3,
    shadowOpacity: 0.3,
    elevation: 10,
  },
  default: {
    shadowColor: colors.light.shadowMedium,
    shadowOffset: { width: 2, height: 5 },
    shadowRadius: 3,
    shadowOpacity: 0.3,
    elevation: 10,
  },
  warning: {
    shadowColor: colors.light.colorStatus_Warning,
    shadowOffset: { width: 2, height: 5 },
    shadowRadius: 3,
    shadowOpacity: 0.3,
    elevation: 10,
  },
  error: {
    shadowColor: colors.light.colorStatus_Lost,
    shadowOffset: { width: 2, height: 5 },
    shadowRadius: 3,
    shadowOpacity: 0.3,
    elevation: 10,
  },
  success: {
    shadowColor: colors.light.colorStatus_Won,
    shadowOffset: { width: 2, height: 5 },
    shadowRadius: 3,
    shadowOpacity: 0.3,
    elevation: 10,
  },
};
 
export function getDialogBoxTitleColor(theme: ThemeColors, variant: NativeDialogBoxVariant) {
  const themedColors = colors[theme];
 
  switch (variant) {
    case 'info':
      return themedColors.colorPrimary;
    case 'warning':
      return themedColors.colorStatus_Warning;
    case 'error':
      return themedColors.colorStatus_Error;
    case 'success':
      return themedColors.colorStatus_Success;
    default:
      return themedColors.colorText_Active;
  }
}