-
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
Enhance the new color picker design #34598
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 |
---|---|---|
|
@@ -6,13 +6,32 @@ import styled from '@emotion/styled'; | |
/** | ||
* Internal dependencies | ||
*/ | ||
import NumberControl from '../../number-control'; | ||
import InnerSelectControl from '../../select-control'; | ||
import InnerRangeControl from '../../range-control'; | ||
import { StyledField } from '../../base-control/styles/base-control-styles'; | ||
import { space } from '../utils/space'; | ||
import Button from '../../button'; | ||
import { | ||
BackdropUI, | ||
Container as InputControlContainer, | ||
Input, | ||
} from '../../input-control/styles/input-control-styles'; | ||
import InputControl from '../../input-control'; | ||
import CONFIG from '../../utils/config-values'; | ||
|
||
export const NumberControlWrapper = styled( NumberControl )` | ||
${ InputControlContainer } { | ||
width: ${ space( 24 ) }; | ||
} | ||
`; | ||
|
||
export const SelectControl = styled( InnerSelectControl )` | ||
margin-left: ${ space( -2 ) }; | ||
width: 5em; | ||
${ BackdropUI } { | ||
display: none; | ||
} | ||
`; | ||
|
||
export const RangeControl = styled( InnerRangeControl )` | ||
|
@@ -23,6 +42,25 @@ export const RangeControl = styled( InnerRangeControl )` | |
} | ||
`; | ||
|
||
// All inputs should be the same height so this should be changed at the component level. | ||
// That involves changing heights of multiple input types probably buttons too etc. | ||
// So until that is done we are already using the new height on the color picker so it matches the mockups. | ||
const inputHeightStyle = ` | ||
&&& ${ Input } { | ||
height: 40px; | ||
}`; | ||
|
||
// Make the Hue circle picker not go out of the bar | ||
const interactiveHueStyles = ` | ||
.react-colorful__interactive { | ||
width: calc( 100% - ${ space( 2 ) } ); | ||
margin-left: ${ space( 1 ) }; | ||
}`; | ||
|
||
export const AuxiliaryColorArtefactWrapper = styled.div` | ||
padding: ${ space( 2 ) } ${ space( 4 ) }; | ||
`; | ||
|
||
export const ColorfulWrapper = styled.div` | ||
width: 216px; | ||
|
||
|
@@ -53,9 +91,26 @@ export const ColorfulWrapper = styled.div` | |
.react-colorful__pointer { | ||
height: 16px; | ||
width: 16px; | ||
border: ${ CONFIG.borderWidthFocus } solid rgba( 255, 255, 255, 0 ); | ||
box-shadow: inset 0px 0px 0px ${ CONFIG.borderWidthFocus } #ffffff; | ||
Comment on lines
+94
to
+95
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. We should probably use the 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'm not sure if this technique works for this case given that we need border and box-shadow at the same time. 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. You can stack box shadows, that's what I did in 2997a2f. |
||
} | ||
|
||
${ interactiveHueStyles } | ||
|
||
${ StyledField } { | ||
margin-bottom: 0; | ||
} | ||
|
||
${ inputHeightStyle } | ||
`; | ||
|
||
export const DetailsControlButton = styled( 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. It's a bit unfortunate that this is not a button that can be shown properly with just props. Why do we need to tweak instead of relying on composition of uncustomized Button (is the isSmall prop not enough?) 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 isSmall prop on buttons with just an icon creates a 36-pixel width per 24 pixels height. Here we want a 24x24 pixels 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.
Do you think we should fix it in the button's styles instead?
According to this style from the button's styles, it's meant to be 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. Good point, I will try to understand if it is a bug or not that the button appears with 36px, but the padding and other styles suggest it is intentional. |
||
&&&& { | ||
min-width: ${ space( 6 ) }; | ||
padding: 0; | ||
} | ||
`; | ||
|
||
export const ColorHexInputControl = styled( InputControl )` | ||
width: 8em; | ||
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 guess I have similar questions for all the customized lower level components: InputControl, SelectControl, NumberControl... All of these get specific styles here. While in some cases it's fine, I do wonder whether our components don't compose well enough. In other words, if we struggle to use the base components ourselves to build higher-level ones, it's most likely that the same struggles will exist for folks trying to use the components in their apps (or other wordpress packages like block-editor, edit-post...) |
||
`; |
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.
Could you please open a new issue for this task, and add it to tracking issue #34284?