Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Firestorm980 committed Jun 24, 2024
1 parent 8a164d1 commit 2510b9d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions components/media-toolbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ export const MediaToolbar: React.FC<MediaToolbarProps> = ({
isOptional = false,
id,
labels = {
replace: __('Replace Image', '10up-block-components'),
remove: __('Remove Image', '10up-block-components'),
add: __('Add Image', '10up-block-components'),
remove: __('Remove Image', '10up-block-components'),
replace: __('Replace Image', '10up-block-components'),
},
}) => {
const hasImage = !!id;
Expand Down
9 changes: 8 additions & 1 deletion components/media-toolbar/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The MediaToolbar component is build to quickly add a complete media editing expe
## Usage

```js
import { __ } from '@wordpress/i18n';
import { BlockControls } from '@wordpress/block-editor';
import { MediaToolbar } from '@10up/block-components';

Expand All @@ -28,6 +29,11 @@ function BlockEdit(props) {
id={ imageId }
onSelect={ handleImageSelect }
onRemove={ handleImageRemove }
labels={{
add: __('Custom add label'),
remove: __('Custom remove label'),
replace: __('Custom replace label'),
}}
/>
</BlockControls>
...
Expand All @@ -43,4 +49,5 @@ function BlockEdit(props) {
| `id` | `number` | `null` | image id |
| `onSelect` | `Function` | `null` | Callback that gets called with the new image when one is selected |
| `onRemove` | `Function` | `null` | Callback that gets called when the remove image button is clicked |
| `isOptional` | `boolean` | `false` | Wether or not the Remove Image button should be shown |
| `isOptional` | `boolean` | `false` | Whether or not the Remove Image button should be shown |
| `labels` | `object` | `{}` | Custom labels prop. Used to override default labels for better UX when using different media types. Allows the sub properties `add`, `remove`, and `replace`. |

0 comments on commit 2510b9d

Please sign in to comment.