Skip to content

Commit

Permalink
Merge pull request #32431 from JKobrynski/migrateReceiptEmptyStateToT…
Browse files Browse the repository at this point in the history
…ypeScript

[TypeScript Migration] Migrate ReceiptEmptyState.js to TypeScript
  • Loading branch information
Joel Bettner authored Jan 19, 2024
2 parents 68e997d + 3ad4a24 commit ff89438
Showing 1 changed file with 8 additions and 12 deletions.
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;

0 comments on commit ff89438

Please sign in to comment.