This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
Sale Product Block: Enable global style #5565
Merged
Merged
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e9d7c30
Product title: add support global style #4965
gigitux 517f80a
add specific type
gigitux 48709c7
add custom save function
gigitux 6d79824
move hooks in a specific folder
gigitux 4bcdc58
Merge branch 'trunk' of github.com:woocommerce/woocommerce-gutenberg-…
gigitux a17ca36
fix crash on WP 5.8
gigitux 8e2f0dc
Featured Category block: Add support for global style #4965
gigitux 1d9cf47
fix border color
gigitux c2cab62
Merge branch 'trunk' of github.com:woocommerce/woocommerce-gutenberg-…
gigitux 99e600b
Sale Product block: enable global style #4965
gigitux 19f5f54
Merge branch 'add/4965-featured-category' of github.com:woocommerce/w…
gigitux 9711034
Merge branch 'trunk' of github.com:woocommerce/woocommerce-gutenberg-…
gigitux b98159a
Merge branch 'trunk' of github.com:woocommerce/woocommerce-gutenberg-…
gigitux 19c0341
add comment
gigitux b80846d
Merge branch 'trunk' into add/4965-sale-product
gigitux 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
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
21 changes: 21 additions & 0 deletions
21
assets/js/atomic/blocks/product-elements/sale-badge/save.tsx
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,21 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { useBlockProps } from '@wordpress/block-editor'; | ||
import classnames from 'classnames'; | ||
|
||
type Props = { | ||
attributes: Record< string, unknown > & { | ||
className?: string; | ||
}; | ||
}; | ||
|
||
export const Save = ( { attributes }: Props ): JSX.Element => { | ||
return ( | ||
<div | ||
{ ...useBlockProps.save( { | ||
className: classnames( 'is-loading', attributes.className ), | ||
} ) } | ||
/> | ||
); | ||
}; |
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 |
---|---|---|
|
@@ -13,4 +13,10 @@ | |
font-weight: 600; | ||
z-index: 9; | ||
position: static; | ||
|
||
span { | ||
color: inherit; | ||
background-color: inherit; | ||
} | ||
|
||
} |
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,56 @@ | ||
<?php | ||
namespace Automattic\WooCommerce\Blocks\BlockTypes; | ||
|
||
/** | ||
* ProductTag class. | ||
*/ | ||
class ProductSaleBadge extends AbstractBlock { | ||
|
||
/** | ||
* Block name. | ||
* | ||
* @var string | ||
*/ | ||
protected $block_name = 'product-sale-badge'; | ||
|
||
/** | ||
* API version name. | ||
* | ||
* @var string | ||
*/ | ||
protected $api_version = '2'; | ||
|
||
/** | ||
* Get block attributes. | ||
* | ||
* @return array | ||
*/ | ||
protected function get_block_type_supports() { | ||
return array( | ||
'color' => | ||
array( | ||
'gradients' => true, | ||
'background' => true, | ||
'link' => true, | ||
), | ||
'typography' => | ||
array( | ||
'fontSize' => true, | ||
'lineHeight' => true, | ||
), | ||
'__experimentalBorder' => | ||
array( | ||
'color' => true, | ||
'radius' => true, | ||
'width' => true, | ||
), | ||
'spacing' => | ||
array( | ||
'padding' => true, | ||
'__experimentalSkipSerialization' => true, | ||
), | ||
'__experimentalSelector' => '.wc-block-components-product-sale-badge', | ||
); | ||
} | ||
|
||
} |
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
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 think a comment here explaining why we register an atomic block here will be helpful.
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.
Good point! I added a
@todo comment
. In this way, in the end, I will re-organize the order of the elements in the array (maybe we can move down the atomic blocks and add a comment that explains why)