mirror of https://github.com/Wilfred/difftastic/
parent
1c9ae2fbc6
commit
1830d286e0
@ -0,0 +1,53 @@
|
||||
const AttachmentInput: FC<AttachmentInputProps> = ({
|
||||
title,
|
||||
accept,
|
||||
setFiles,
|
||||
files,
|
||||
name,
|
||||
isInvalid,
|
||||
}) => {
|
||||
return (
|
||||
<div style={STYLES.attachmentInput} data-testid="attachment-input">
|
||||
<span style={STYLES.title}>{title}</span>
|
||||
<DropZone
|
||||
accept={accept}
|
||||
onNewFiles={onNewFiles}
|
||||
multiple
|
||||
name={name}
|
||||
isInvalid={isInvalid}
|
||||
>
|
||||
<Button variant="outline-secondary" className="my-1">
|
||||
<FontAwesomeIcon
|
||||
icon={faPlus}
|
||||
/>
|
||||
{" "}
|
||||
Adicionar arquivos
|
||||
{" "}
|
||||
|
||||
</Button>
|
||||
</DropZone>
|
||||
{" "}
|
||||
{files.length > 0 && (
|
||||
<div data-testid="attachment-files-names">
|
||||
<div className="ml-1" style={STYLES.toBeSentLabel}>{"Arquivos a enviar: "}</div>
|
||||
{files.map((file) => (
|
||||
<Badge
|
||||
variant="secondary"
|
||||
key={file.name}
|
||||
className="mr-1 px-3"
|
||||
style={STYLES.badge}
|
||||
>
|
||||
<div style={STYLES.badgeText}>{file.name}</div>
|
||||
<FontAwesomeIcon
|
||||
icon={faTimes}
|
||||
className="ml-2"
|
||||
data-testid="attachment-files-remove"
|
||||
onClick={() => onFileRemoved(file)}
|
||||
/>
|
||||
</Badge>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@ -0,0 +1,48 @@
|
||||
const AttachmentInput: FC<AttachmentInputProps> = ({
|
||||
title,
|
||||
accept,
|
||||
setFiles,
|
||||
files,
|
||||
name,
|
||||
isInvalid,
|
||||
}) => {
|
||||
return (
|
||||
<div style={STYLES.attachmentInput} data-testid="attachment-input">
|
||||
<span style={STYLES.title}>{title}</span>
|
||||
<DropZone
|
||||
accept={accept}
|
||||
onNewFiles={onNewFiles}
|
||||
multiple
|
||||
name={name}
|
||||
isInvalid={isInvalid}
|
||||
>
|
||||
<Button variant="outline-secondary" className="my-1">
|
||||
<FontAwesomeIcon icon={faPlus} /> Adicionar arquivos{" "}
|
||||
</Button>
|
||||
</DropZone>{" "}
|
||||
{files.length > 0 && (
|
||||
<div data-testid="attachment-files-names">
|
||||
<div className="ml-1" style={STYLES.toBeSentLabel}>
|
||||
{"Arquivos a enviar: "}
|
||||
</div>
|
||||
{files.map((file) => (
|
||||
<Badge
|
||||
variant="secondary"
|
||||
key={file.name}
|
||||
className="mr-1 px-3"
|
||||
style={STYLES.badge}
|
||||
>
|
||||
<div style={STYLES.badgeText}>{file.name}</div>
|
||||
<FontAwesomeIcon
|
||||
icon={faTimes}
|
||||
className="ml-2"
|
||||
data-testid="attachment-files-remove"
|
||||
onClick={() => onFileRemoved(file)}
|
||||
/>
|
||||
</Badge>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
Loading…
Reference in New Issue