Skip to content

Commit

Permalink
feat: Add restrictedTypes prop to KnowledgeUploadInput component
Browse files Browse the repository at this point in the history
  • Loading branch information
HaruHunab1320 committed Jun 27, 2024
1 parent a7a73ae commit 2dc2780
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ type KnowledgeUploadInputProps = {
const allowedTypes = [
'.eml, .txt, .html, .json, .md, .msg, .rst, .rtf, .txt, .xml, .jpeg, .jpg, .png, .csv, .doc, .docx, .epub, .odt, .pdf, .ppt, .pptx, .tsv, .xlsx',
]
export const KnowledgeUploadInput: React.FC<KnowledgeUploadInputProps> = ({
inputProps,
}) => {
export const KnowledgeUploadInput: React.FC<
KnowledgeUploadInputProps & {
restrictedTypes?: string[]
}
> = ({ inputProps, restrictedTypes }) => {
const { disabled, ...rest } = inputProps

const showRestrictedTypes = restrictedTypes && restrictedTypes.length > 0
return (
<div>
<label
Expand All @@ -35,7 +37,11 @@ export const KnowledgeUploadInput: React.FC<KnowledgeUploadInputProps> = ({
<span className="font-semibold">Click to upload</span> or{' '}
<span className="font-semibold">drag and drop</span>
</p>
<p className="text-xs mx-8 text-center">{allowedTypes.join(', ')}</p>
<p className="text-xs mx-8 text-center">
{showRestrictedTypes
? restrictedTypes.join(', ')
: allowedTypes.join(', ')}
</p>
</div>
<input
id="dropzone-file"
Expand Down

0 comments on commit 2dc2780

Please sign in to comment.