From c3e7c5442fac84e1ca7710e2a4ff82cca7ce07a7 Mon Sep 17 00:00:00 2001 From: Marko Andrijasevic Date: Tue, 24 Nov 2020 12:40:12 +0100 Subject: [PATCH] Add option to override icon and href --- .../slotfills/main-dashboard-button.md | 2 +- .../header/fullscreen-mode-close/index.js | 20 ++++++++++++++----- .../header/fullscreen-mode-close/style.scss | 3 +-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/docs/designers-developers/developers/slotfills/main-dashboard-button.md b/docs/designers-developers/developers/slotfills/main-dashboard-button.md index ba87a04be80379..3392eed131218f 100644 --- a/docs/designers-developers/developers/slotfills/main-dashboard-button.md +++ b/docs/designers-developers/developers/slotfills/main-dashboard-button.md @@ -40,7 +40,7 @@ import { close } from '@wordpress/icons'; const MainDashboardButtonIconTest = () => ( - + ); diff --git a/packages/edit-post/src/components/header/fullscreen-mode-close/index.js b/packages/edit-post/src/components/header/fullscreen-mode-close/index.js index d7da08c758470f..93d7f680487930 100644 --- a/packages/edit-post/src/components/header/fullscreen-mode-close/index.js +++ b/packages/edit-post/src/components/header/fullscreen-mode-close/index.js @@ -12,7 +12,7 @@ import { __ } from '@wordpress/i18n'; import { addQueryArgs } from '@wordpress/url'; import { wordpress } from '@wordpress/icons'; -function FullscreenModeClose( { showTooltip } ) { +function FullscreenModeClose( { showTooltip, icon, href } ) { const { isActive, isRequestingSiteIcon, postType, siteIconUrl } = useSelect( ( select ) => { const { getCurrentPostType } = select( 'core/editor' ); @@ -50,16 +50,26 @@ function FullscreenModeClose( { showTooltip } ) { src={ siteIconUrl } /> ); - } else if ( isRequestingSiteIcon ) { + } + + if ( isRequestingSiteIcon ) { buttonIcon = null; } + // Override default icon if custom icon is provided via props. + if ( icon ) { + buttonIcon = ; + } + return (