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
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sale Product Block: Enable global style (#5565)
* Product title: add support global style #4965 * add specific type * add custom save function * move hooks in a specific folder * fix crash on WP 5.8 * Featured Category block: Add support for global style #4965 Featured Category block: Add support for global style * fix border color * Sale Product block: enable global style #4965 Sale Product block: enable global style #4965 * add comment
- Loading branch information
Showing
7 changed files
with
138 additions
and
4 deletions.
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