-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add a GlobalStylesScreenRootSlot slot in Global Styles root screen #49136
base: trunk
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,11 +11,13 @@ import { | |
Card, | ||
CardDivider, | ||
CardMedia, | ||
createSlotFill, | ||
} from '@wordpress/components'; | ||
import { isRTL, __ } from '@wordpress/i18n'; | ||
import { chevronLeft, chevronRight } from '@wordpress/icons'; | ||
import { useSelect } from '@wordpress/data'; | ||
import { store as coreStore } from '@wordpress/core-data'; | ||
import { Fragment } from '@wordpress/element'; | ||
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; | ||
|
||
/** | ||
|
@@ -27,6 +29,23 @@ import ContextMenu from './context-menu'; | |
import StylesPreview from './preview'; | ||
import { unlock } from '../../private-apis'; | ||
|
||
const { Slot: GlobalStylesScreenRootSlot } = createSlotFill( | ||
'GlobalStylesScreenRoot' | ||
); | ||
|
||
const ScreenRootSlot = () => ( | ||
<GlobalStylesScreenRootSlot> | ||
{ ( fills ) => | ||
fills.map( ( fill, index ) => ( | ||
<Fragment key={ index }> | ||
<CardBody>{ fill }</CardBody> | ||
<CardDivider /> | ||
</Fragment> | ||
) ) | ||
} | ||
</GlobalStylesScreenRootSlot> | ||
); | ||
|
||
function ScreenRoot() { | ||
const { useGlobalStyle } = unlock( blockEditorPrivateApis ); | ||
const [ customCSS ] = useGlobalStyle( 'css' ); | ||
|
@@ -52,6 +71,8 @@ function ScreenRoot() { | |
|
||
return ( | ||
<Card size="small" className="edit-site-global-styles-screen-root"> | ||
<ScreenRootSlot /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a too prominent place to add a slot and plugins will compete too much for place. I think the preview and variations should stay at the top. Let's move this slot after the "browse styles" button There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd echo Riad on this one. After |
||
|
||
<CardBody> | ||
<VStack spacing={ 4 }> | ||
<Card> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be exposing the API in edit-site/src/index like we do for all the slots?