Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
69be2ab
getBlockTypeWithVariationInfo selector, BlockDescription component an…
ntsekouras Dec 4, 2020
20eeea3
revert BlockCard component and make the passed attributes top level w…
ntsekouras Dec 10, 2020
1647ae0
remove BlockDescription
ntsekouras Dec 10, 2020
4d5b176
change InserterPreviewPanel to use BlockCard with passing top level p…
ntsekouras Dec 10, 2020
23d0f61
create new custom hook for block's display information
ntsekouras Dec 10, 2020
93013a8
use new hook in BlockInspector
ntsekouras Dec 10, 2020
5fab0e5
revert BlockIcon and augment BlockTitle
ntsekouras Dec 10, 2020
42271d8
Navigation List View update
ntsekouras Dec 10, 2020
c94f11c
remove previous selector
ntsekouras Dec 10, 2020
9926c72
refactor BlockSwitcher to function component and use the new hook
ntsekouras Dec 10, 2020
ae9f53a
change hook
ntsekouras Dec 10, 2020
1697329
use CreateSelector and declare WPBlockDisplayInformation typedef
ntsekouras Dec 11, 2020
0784acf
revert BlockSwitcher to handle in separate PR
ntsekouras Dec 15, 2020
88fd610
remove getBlockDisplayInformation selector
ntsekouras Dec 15, 2020
6b8169b
add `isActive` API for block variations to use for trying to find a m…
ntsekouras Dec 15, 2020
ec4aa29
doc for `isActive` in block variation
ntsekouras Dec 15, 2020
4b261bb
jsdoc fix
ntsekouras Dec 15, 2020
37949ca
address review feedback part 1
ntsekouras Dec 16, 2020
2f6598e
fix BlockTitle tests
ntsekouras Dec 16, 2020
a8a8302
rename hook to `useBlockDisplayInformation`
ntsekouras Dec 16, 2020
9675f07
fix export
ntsekouras Dec 16, 2020
113f761
useBlockDisplayInformation README
ntsekouras Dec 16, 2020
0f720b6
move login in useSelect
ntsekouras Dec 17, 2020
410fc74
e2e tests
ntsekouras Dec 17, 2020
8501b34
blockTitle extra safeguard that existed before
ntsekouras Dec 17, 2020
1763959
Update docs
ntsekouras Dec 23, 2020
65a8910
Update docs
ntsekouras Dec 23, 2020
9ec01e6
Update docs
ntsekouras Dec 23, 2020
9ec1bee
Update docs
ntsekouras Dec 23, 2020
89c480c
rewordings
ntsekouras Dec 23, 2020
438831a
remove experimental status
ntsekouras Dec 23, 2020
bef032b
small refactoring
ntsekouras Dec 23, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor BlockSwitcher to function component and use the new hook
  • Loading branch information
ntsekouras committed Dec 18, 2020
commit 9926c72c269e0500e908019e9cc881758c0c4a89
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { MenuGroup } from '@wordpress/components';
import { useState } from '@wordpress/element';

/**
* Internal dependencies
*/
import BlockStyles from '../block-styles';
import PreviewBlockPopover from './preview-block-popover';

const BlockStylesMenu = ( { hoveredBlock, onSwitch } ) => {
const [ hoveredClassName, setHoveredClassName ] = useState();
return (
<MenuGroup
label={ __( 'Styles' ) }
className="block-editor-block-switcher__styles__menugroup"
>
{ hoveredClassName && (
<PreviewBlockPopover
hoveredBlock={ hoveredBlock }
hoveredClassName={ hoveredClassName }
/>
) }
<BlockStyles
clientId={ hoveredBlock.clientId }
onSwitch={ onSwitch }
onHoverClassName={ setHoveredClassName }
itemRole="menuitem"
/>
</MenuGroup>
);
};
export default BlockStylesMenu;
Loading