KarimMokhtar / react-drag-drop-files

Light and simple Reactjs drag and drop files library to use with very flexible options to change, so you put whatever the design you want for your drop-area. Users can drag and drop or even select the file anywhere in the window.
MIT License
248 stars 91 forks source link

feat: add messages prop to change some static texts #118

Open alecshoppe opened 1 year ago

alecshoppe commented 1 year ago

Summary

[What does this PR introduce?] A way to change some static messages

Key Changes

MessagesType {
  disabled?: string      // changes the disabled text
  uploaded?: string    // changes the uploaded underline text
  upload_another?: string  // changes the upload another text
  error?: string    // changes the generic error text
  drop?: string    // changes the drop here text (override the "hoverTitle")
  upload?: string  // changes the upload underline text
  or_message?: string  // changes the or text after upload underline text
}

In order to messages.upload and messages.or_message to work, you need to not declare the "label" like this:

<FileUploader handleChange={handleChangeFile} name="file" file={file} messages={{ disabled: 'Disabled image', uploaded: 'Upload done!', upload_another: 'Change file', error: 'Error, check file type and size', drop: 'Drop file here', upload: 'Choose image', or_message: 'or drag the file here' }} hideTypes types={["jpg", "png", "jpeg"]} />

Check List

Muhammadsaqib11 commented 1 year ago

i am adding message object wiith all fields but it doesn,t have any kind of effect on it. @alecshoppe

KarimMokhtar commented 2 weeks ago

@alecshoppe I suggest, add each field as prop better