import clsx from 'clsx'; import React, { useRef } from 'react'; import { FormattedMessage, defineMessages, useIntl } from 'react-intl'; import { HStack, Icon, IconButton, Text } from 'soapbox/components/ui'; import { useDraggedFiles } from 'soapbox/hooks'; const messages = defineMessages({ title: { id: 'group.upload_banner.title', defaultMessage: 'Upload background picture' }, }); interface IMediaInput { src: string | undefined accept: string onChange: (files: FileList | null) => void onClear?: () => void disabled?: boolean } const HeaderPicker = React.forwardRef(({ src, onChange, onClear, accept, disabled }, ref) => { const intl = useIntl(); const picker = useRef(null); const { isDragging, isDraggedOver } = useDraggedFiles(picker, (files) => { onChange(files); }); const handleClear: React.MouseEventHandler = (e) => { e.stopPropagation(); onClear!(); }; return ( ); }); export default HeaderPicker;