Skip to content

Commit

Permalink
Merge pull request #1 from iamleese/1.0.2
Browse files Browse the repository at this point in the history
Added Drop Zone Component
  • Loading branch information
iamleese authored Jun 8, 2023
2 parents 6e023ee + 7045e9a commit c932dd4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ information when the animation block comes in view.


## Changelog
### 1.0.2 (6/2/2023)
* Added "Drop Zone" for blocks.

### 1.0.1 (4/24/2023)
* Added intuitive "call" function with updated instructions.
Expand Down
17 changes: 16 additions & 1 deletion src/animation-block/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import { __ } from '@wordpress/i18n';
import { useBlockProps, InnerBlocks, InspectorControls } from '@wordpress/block-editor';
import { Panel, PanelBody, PanelRow, SelectControl, ToggleControl, RangeControl, TextControl } from '@wordpress/components';
import { Panel, PanelBody, PanelRow, SelectControl, ToggleControl, RangeControl, TextControl, DropZone } from '@wordpress/components';
import { useState } from '@wordpress/element';

import icons from './icons.js'
Expand Down Expand Up @@ -46,12 +46,27 @@ export default function Edit( { attributes, setAttributes } ) {
}
}

const BlockInserter = () => {
const [ hasDropped, setHasDropped ] = useState( false );

return (
<div>
{ hasDropped ? 'Dropped!' : 'Drop something here' }
<DropZone
onFilesDrop={ () => setHasDropped( true ) }
onHTMLDrop={ () => setHasDropped( true ) }
onDrop={ () => setHasDropped( true ) }
/>
</div>
);
}




return (
<div { ...blockProps } >
<BlockInserter />

<InspectorControls key="setting">
<Panel>
Expand Down

0 comments on commit c932dd4

Please sign in to comment.