import React from 'react'; import type { ReactElement } from 'react'; import type { StyleProp, ViewStyle } from 'react-native'; import { StyledContainer, StyledContentContainer, StyledCTAWrapper, StyledTextContainer, } from './StyledAttachment'; import type { IconProps } from '../Icon'; import Icon from '../Icon'; import Typography from '../Typography'; import type { ImageProps } from '../Image'; interface AttachmentProps { /** * Attachment filename. */ filename?: string; /** * Attachment preview element. */ previewElement: ReactElement; /** * Removing callback. When onRemove is available, a trash icon will be rendered on the right side. The callback will be called when user clicks on trash icon. */ onRemove?: () => void; /** * Downloading callback. When onDownload is available, a download icon will be rendered on the right side. The callback will be called when user clicks on download icon. */ onDownload?: () => void; /** * The background of the attachment's content will be highlighted if backgroundHighlighted is true. * Default value is false. */ backgroundHighlighted?: boolean; /** * Addtional style. */ style?: StyleProp; /** * Testing id of the component. */ testID?: string; } const Attachment = ({ filename, previewElement, onRemove, onDownload, backgroundHighlighted = false, style, testID, }: AttachmentProps) => ( {previewElement} {filename ? ( {filename} ) : null} {onDownload ? ( ) : null} {onRemove ? ( ) : null} ); export default Attachment;