Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
import PropTypes from 'prop-types';
import React from 'react';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import variables from '@styles/variables';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback';

const propTypes = {
type ReceiptEmptyStateProps = {
/** Whether or not there is an error */
hasError: PropTypes.bool,
hasError?: boolean;

/** Callback to be called on onPress */
onPress: PropTypes.func,
};

const defaultProps = {
hasError: false,
onPress: () => {},
onPress?: () => void;
};

// Returns an SVG icon indicating that the user should attach a receipt
function ReceiptEmptyState({hasError, onPress}) {
function ReceiptEmptyState({hasError = false, onPress = () => {}}: ReceiptEmptyStateProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();

return (
<PressableWithoutFeedback
accessibilityRole="imagebutton"
accessibilityLabel={translate('receipt.upload')}
onPress={onPress}
style={[styles.alignItemsCenter, styles.justifyContentCenter, styles.moneyRequestViewImage, styles.moneyRequestAttachReceipt, hasError && styles.borderColorDanger]}
>
Expand All @@ -38,7 +36,5 @@ function ReceiptEmptyState({hasError, onPress}) {
}

ReceiptEmptyState.displayName = 'ReceiptEmptyState';
ReceiptEmptyState.propTypes = propTypes;
ReceiptEmptyState.defaultProps = defaultProps;

export default ReceiptEmptyState;