Skip to content

Commit ad8934f

Browse files
committed
Add block controls for settings in top-charts block
1 parent dc4c0c6 commit ad8934f

File tree

1 file changed

+18
-3
lines changed
  • packages/block-library/top-charts

1 file changed

+18
-3
lines changed

packages/block-library/top-charts/edit.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
useBlockProps,
77
BlockContextProvider,
88
useInnerBlocksProps,
9+
BlockControls,
910
} from '@wordpress/block-editor';
1011
import { useEntityProp } from '@wordpress/core-data';
1112
import { useEffect, useState } from '@wordpress/element';
@@ -17,7 +18,10 @@ import {
1718
Placeholder,
1819
__experimentalHStack as HStack,
1920
__experimentalInputControl as InputControl,
21+
ToolbarGroup,
22+
ToolbarButton,
2023
} from '@wordpress/components';
24+
import { edit } from '@wordpress/icons';
2125

2226
const Edit = ( {
2327
attributes: { collection },
@@ -105,9 +109,20 @@ const Edit = ( {
105109
}
106110

107111
return (
108-
<BlockContextProvider value={ { collection: items } }>
109-
<div { ...innerBlockProps } />
110-
</BlockContextProvider>
112+
<>
113+
<BlockControls>
114+
<ToolbarGroup>
115+
<ToolbarButton
116+
label={ __( 'Change Settings', 'profile-blocks-lastfm' ) }
117+
icon={ edit }
118+
onClick={ () => setShowSetup( true ) }
119+
/>
120+
</ToolbarGroup>
121+
</BlockControls>
122+
<BlockContextProvider value={ { collection: items } }>
123+
<div { ...innerBlockProps } />
124+
</BlockContextProvider>
125+
</>
111126
);
112127
};
113128
export default Edit;

0 commit comments

Comments
 (0)