Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site Logo: Move Reset button to the Replace menu dropdown #35372

Merged
merged 2 commits into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,10 @@ Removes a media replace notice.

- Type: `func`
- Required: No

### children

- Type: `Element`
- Required: No

If passed, children are rendered inside the dropdown.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const MediaReplaceFlow = ( {
name = __( 'Replace' ),
createNotice,
removeNotice,
children,
} ) => {
const [ mediaURLValue, setMediaURLValue ] = useState( mediaURL );
const mediaUpload = useSelect( ( select ) => {
Expand Down Expand Up @@ -161,6 +162,7 @@ const MediaReplaceFlow = ( {
} }
/>
</MediaUploadCheck>
{ children }
</NavigableMenu>
{ onSelectURL && (
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
Expand Down
13 changes: 6 additions & 7 deletions packages/block-library/src/site-logo/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import { isBlobURL } from '@wordpress/blob';
import { useEffect, useState, useRef } from '@wordpress/element';
import { __, isRTL } from '@wordpress/i18n';
import {
MenuItem,
Notice,
PanelBody,
RangeControl,
ResizableBox,
Spinner,
ToggleControl,
ToolbarButton,
ToolbarGroup,
Placeholder,
} from '@wordpress/components';
import { useViewportMatch } from '@wordpress/compose';
Expand All @@ -35,7 +35,7 @@ import {
} from '@wordpress/block-editor';
import { useSelect, useDispatch } from '@wordpress/data';
import { store as coreStore } from '@wordpress/core-data';
import { crop, siteLogo as icon } from '@wordpress/icons';
import { crop, reset, siteLogo as icon } from '@wordpress/icons';

/**
* Internal dependencies
Expand Down Expand Up @@ -398,12 +398,11 @@ export default function LogoEdit( {
accept={ ACCEPT_MEDIA_STRING }
onSelect={ onSelectLogo }
onError={ onUploadError }
/>
<ToolbarGroup>
<ToolbarButton onClick={ onRemoveLogo }>
>
<MenuItem icon={ reset } onClick={ onRemoveLogo }>
{ __( 'Reset' ) }
</ToolbarButton>
</ToolbarGroup>
</MenuItem>
</MediaReplaceFlow>
</BlockControls>
);

Expand Down