-
Notifications
You must be signed in to change notification settings - Fork 220
Add dark colors support to Cart & Checkout controls #2981
Changes from 19 commits
09776e3
8adfc26
1a0daca
bab3e91
42ae59d
ab8a010
e68bb35
9772b56
1b93532
7ce37f2
c3b6990
1faf2bc
9c6dbe1
9e4813a
2816f72
bf6fb6b
f0410c3
b56694e
11d2fb3
29eb311
336d10b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,9 @@ | |
max-width: calc(100% - #{2 * $gap}); | ||
cursor: text; | ||
|
||
.has-dark-controls & { | ||
color: $input-placeholder-dark; | ||
} | ||
@media screen and (prefers-reduced-motion: reduce) { | ||
transition: none; | ||
} | ||
|
@@ -54,6 +57,11 @@ | |
&:focus { | ||
background-color: #fff; | ||
} | ||
.has-dark-controls & { | ||
background-color: $input-background-dark; | ||
border-color: $input-border-dark; | ||
color: $input-text-dark; | ||
} | ||
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. ❤️ how clean and simple all the new dark-mode rules are now - opt-in to alternative, standardised colours. 👌 |
||
} | ||
|
||
&.is-active input[type="tel"], | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
import { | ||
IS_SHIPPING_CALCULATOR_ENABLED, | ||
IS_SHIPPING_COST_HIDDEN, | ||
HAS_DARK_EDITOR_STYLE_SUPPORT, | ||
} from '@woocommerce/block-settings'; | ||
|
||
const blockAttributes = { | ||
|
@@ -24,6 +25,10 @@ const blockAttributes = { | |
type: 'number', | ||
default: 0, | ||
}, | ||
hasDarkControls: { | ||
type: 'boolean', | ||
default: HAS_DARK_EDITOR_STYLE_SUPPORT, | ||
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 might not be a big deal .. but I'm still a bit confused about the relationship between
I think it's probably fine to use it as the default, but since they are quite different it would be good to have a comment explaining the intention with the default. Here's my understanding of why we're using this as the default:
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.
Yes, we have this method to assume a theme is dark:
A theme can also register support for |
||
}, | ||
}; | ||
|
||
export default blockAttributes; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,7 @@ const BlockSettings = ( { attributes, setAttributes } ) => { | |
isShippingCalculatorEnabled, | ||
isShippingCostHidden, | ||
checkoutPageId, | ||
hasDarkControls, | ||
} = attributes; | ||
const { currentPostId } = useEditorContext(); | ||
const { current: savedCheckoutPageId } = useRef( checkoutPageId ); | ||
|
@@ -68,6 +69,24 @@ const BlockSettings = ( { attributes, setAttributes } ) => { | |
) } | ||
</Notice> | ||
) } | ||
<PanelBody title={ __( 'Style', 'woo-gutenberg-products-block' ) }> | ||
<ToggleControl | ||
label={ __( | ||
'Dark mode inputs', | ||
'woo-gutenberg-products-block' | ||
) } | ||
help={ __( | ||
'Inputs styled specifically for use on dark background colors.', | ||
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. Nice new wording! |
||
'woo-gutenberg-products-block' | ||
) } | ||
checked={ hasDarkControls } | ||
onChange={ () => | ||
setAttributes( { | ||
hasDarkControls: ! hasDarkControls, | ||
} ) | ||
} | ||
/> | ||
</PanelBody> | ||
{ SHIPPING_ENABLED && ( | ||
<PanelBody | ||
title={ __( | ||
|
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.
Is this comment still relevant? Not a blocker :)
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.
Not much, but it wasn't added on the previous PR and stayed here during rebase, no point in deleting it and putting it back in a new PR.