Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TypeScript Migration] Migrate ReceiptEmptyState.js to TypeScript #32431

Merged
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;
Loading