-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Global Styles: Improve organisation of site background color and image #63216
Closed
+395
−79
Closed
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
3401d45
Adds background icon
amitraj2203 70fc60f
Removes Background Panel from layout screen
amitraj2203 a555902
Improves organisation of site background image and color options in g…
amitraj2203 c78e9f0
Merge branch 'trunk' of github.com:WordPress/gutenberg into feat/add-…
amitraj2203 5caa672
Fix styling issue after merge conflict
amitraj2203 d6252d6
Resets border radius top and bottom for the first and last control
amitraj2203 4a99ca1
Refactor global styles to fix border focus issue for background panel
amitraj2203 c4a1706
Adds upload icon for background image and change it's shape to rounde…
amitraj2203 635c62e
Change the border-radius to 2px and fix the missing border-top when t…
amitraj2203 7f4951d
Move background panel to the top
mtias f3fc268
Makes use of ColorIndicator component
amitraj2203 9f2d715
Used $radius-small instead of $radius-block-ui
amitraj2203 267a62b
Refactor SVG attributes to adhere to camel case convention
amitraj2203 dba7140
Wraps "Image" and "Color" items with ItemGroup
amitraj2203 f27779e
Merge branch 'trunk' of github.com:WordPress/gutenberg into feat/add-…
amitraj2203 f4e3a7d
feat: Use ItemGroup to wrap the Color and Image item
amitraj2203 f2cc826
Merge branch 'trunk' of github.com:WordPress/gutenberg into feat/add-…
amitraj2203 4f83540
Merge branch 'trunk' of github.com:WordPress/gutenberg into feat/add-…
amitraj2203 98833df
Removed blank lines
amitraj2203 7b8110a
chore: Update showColorControl prop in BackgroundPanel component
amitraj2203 9cd986c
chore: Update use of hasBackgroundPanel in RootMenu component
amitraj2203 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
336 changes: 292 additions & 44 deletions
336
packages/block-editor/src/components/global-styles/background-panel.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,6 +4,7 @@ | |||||
import { __experimentalItemGroup as ItemGroup } from '@wordpress/components'; | ||||||
import { | ||||||
typography, | ||||||
background, | ||||||
color, | ||||||
layout, | ||||||
shadow as shadowIcon, | ||||||
|
@@ -23,6 +24,7 @@ const { | |||||
useHasColorPanel, | ||||||
useGlobalSetting, | ||||||
useSettingsForBlockElement, | ||||||
useHasBackgroundPanel, | ||||||
} = unlock( blockEditorPrivateApis ); | ||||||
|
||||||
function RootMenu() { | ||||||
|
@@ -33,10 +35,20 @@ function RootMenu() { | |||||
const hasShadowPanel = true; // useHasShadowPanel( settings ); | ||||||
const hasDimensionsPanel = useHasDimensionsPanel( settings ); | ||||||
const hasLayoutPanel = hasDimensionsPanel; | ||||||
const hasBackgroundPanel = useHasBackgroundPanel( settings ); | ||||||
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. The background panel doesn't show at all for me at the moment. I think we should be using
Suggested change
|
||||||
|
||||||
return ( | ||||||
<> | ||||||
<ItemGroup> | ||||||
{ hasBackgroundPanel && ( | ||||||
<NavigationButtonAsItem | ||||||
icon={ background } | ||||||
path="/background" | ||||||
aria-label={ __( 'Background styles' ) } | ||||||
> | ||||||
{ __( 'Background' ) } | ||||||
</NavigationButtonAsItem> | ||||||
) } | ||||||
{ hasTypographyPanel && ( | ||||||
<NavigationButtonAsItem | ||||||
icon={ typography } | ||||||
|
34 changes: 34 additions & 0 deletions
34
packages/edit-site/src/components/global-styles/screen-background.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import BackgroundPanel from './background-panel'; | ||
import ScreenHeader from './header'; | ||
import { unlock } from '../../lock-unlock'; | ||
|
||
const { useHasBackgroundPanel, useGlobalSetting } = unlock( | ||
blockEditorPrivateApis | ||
); | ||
|
||
function ScreenBackground() { | ||
const [ settings ] = useGlobalSetting( '' ); | ||
const hasBackgroundPanel = useHasBackgroundPanel( settings ); | ||
return ( | ||
<> | ||
<ScreenHeader | ||
title={ __( 'Background' ) } | ||
description={ __( | ||
'Edit the site background image and color.' | ||
) } | ||
/> | ||
{ hasBackgroundPanel && <BackgroundPanel /> } | ||
</> | ||
); | ||
} | ||
|
||
export default ScreenBackground; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { Path, SVG } from '@wordpress/primitives'; | ||
|
||
const background = ( | ||
<SVG width="24" height="24" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<Path | ||
fillRule="evenodd" | ||
clipRule="evenodd" | ||
d="M11.53 4.47a.75.75 0 1 0-1.06 1.06l8 8a.75.75 0 1 0 1.06-1.06l-8-8Zm5 1a.75.75 0 1 0-1.06 1.06l2 2a.75.75 0 1 0 1.06-1.06l-2-2Zm-11.06 10a.75.75 0 0 1 1.06 0l2 2a.75.75 0 1 1-1.06 1.06l-2-2a.75.75 0 0 1 0-1.06Zm.06-5a.75.75 0 0 0-1.06 1.06l8 8a.75.75 0 1 0 1.06-1.06l-8-8Zm-.06-3a.75.75 0 0 1 1.06 0l10 10a.75.75 0 1 1-1.06 1.06l-10-10a.75.75 0 0 1 0-1.06Zm3.06-2a.75.75 0 0 0-1.06 1.06l10 10a.75.75 0 1 0 1.06-1.06l-10-10Z" | ||
/> | ||
</SVG> | ||
); | ||
|
||
export default background; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I know it was not introduced by this PR, but — as also mentioned about
.components-button
—.components-*
classnames re not meant to be used outside of the components package. We can use custom classnames instead.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 I make the change in this PR only, or a separate PR would be good for it?
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.
Happy for it to be a separate, follow-up PR.
The main changes that would be needed:
36px
height on.components-dropdown
. Ideally, we should use the default button height. If not, let's understand why, and at most use therenderToggle
prop to pass differently sized button;.components-button
, and only use the component props to tweak those aspects (mainly thevariant
prop)className
to the components instances, and then using that custom classname in the styles file;