doc: fix React examples (#3799)

This commit is contained in:
Antoine du Hamel 2022-05-31 12:30:33 +02:00 committed by GitHub
parent 588b909069
commit 6a509df10c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 33 deletions

View file

@ -44,20 +44,25 @@ The `<DragDrop />` component supports all [DragDrop](/docs/drag-drop/) options a
import React from 'react'
import { DragDrop } from '@uppy/react'
<DragDrop
width="100%"
height="100%"
note="Images up to 200×200px"
// assuming `this.uppy` contains an Uppy instance:
uppy={this.uppy}
locale={{
strings: {
// Text to show on the droppable area.
// `%{browse}` is replaced with a link that opens the system file selection dialog.
dropHereOr: 'Drop here or %{browse}',
// Used as the label for the link that opens the system file selection dialog.
browse: 'browse',
},
}}
/>
export default function MyComponent (props) {
const { uppy } = props
return (
<DragDrop
width="100%"
height="100%"
note="Images up to 200×200px"
// assuming `props.uppy` contains an Uppy instance:
uppy={uppy}
locale={{
strings: {
// Text to show on the droppable area.
// `%{browse}` is replaced with a link that opens the system file selection dialog.
dropHereOr: 'Drop here or %{browse}',
// Used as the label for the link that opens the system file selection dialog.
browse: 'browse',
},
}}
/>
)
}
```

View file

@ -44,10 +44,15 @@ The `<FileInput />` component supports all [FileInput](/docs/file-input/) option
import React from 'react'
import { FileInput } from '@uppy/react'
<FileInput
// assuming `this.uppy` contains an Uppy instance:
uppy={this.uppy}
pretty
inputName="files[]"
/>
export default function MyComponent (props) {
const { uppy } = props
return (
<FileInput
// assuming `props.uppy` contains an Uppy instance:
uppy={uppy}
pretty
inputName="files[]"
/>
)
}
```

View file

@ -44,11 +44,17 @@ The `<ProgressBar />` component supports all [`@uppy/progress-bar`][] options as
import React from 'react'
import { ProgressBar } from '@uppy/react'
<ProgressBar
uppy={uppy}
fixed
hideAfterFinish
/>
export default function MyComponent (props) {
const { uppy } = props
return (
<ProgressBar
// assuming `props.uppy` contains an Uppy instance:
uppy={uppy}
fixed
hideAfterFinish
/>
)
}
```
[`@uppy/progress-bar`]: /docs/progress-bar/

View file

@ -44,12 +44,18 @@ The `<StatusBar />` component supports all [`@uppy/status-bar`][] options as pro
import React from 'react'
import { StatusBar } from '@uppy/react'
<StatusBar
uppy={uppy}
hideUploadButton
hideAfterFinish={false}
showProgressDetails
/>
export default function MyComponent (props) {
const { uppy } = props
return (
<StatusBar
// assuming `props.uppy` contains an Uppy instance:
uppy={uppy}
hideUploadButton
hideAfterFinish={false}
showProgressDetails
/>
)
}
```
[`@uppy/status-bar`]: /docs/status-bar/