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.
Remove propTypes definitions from Top Rated Products block (#9595)
* replace propTypes and converted to tsx - product-top-rated/block.js * replace propTypes and converted to tsx - product-top-rated/block.js * converted product-top-rated to typescript * added JSX.Element --------- Co-authored-by: Niels Lange <[email protected]>
- Loading branch information
1 parent
3a2ab1c
commit 94fc948
Showing
5 changed files
with
189 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
{ | ||
"name": "woocommerce/product-top-rated", | ||
"title": "Top Rated Products", | ||
"category": "woocommerce", | ||
"keywords": [ "WooCommerce", "woo-gutenberg-products-block" ], | ||
"description": "Display a grid of your top rated products.", | ||
"supports": { | ||
"align": [ "wide", "full" ], | ||
"html": false | ||
}, | ||
"attributes": { | ||
"columns": { | ||
"type": "number", | ||
"default": 3 | ||
}, | ||
"rows": { | ||
"type": "number", | ||
"default": 3 | ||
}, | ||
"alignButtons": { | ||
"type": "boolean", | ||
"default": false | ||
}, | ||
"contentVisibility": { | ||
"type": "object", | ||
"default": { | ||
"image": true, | ||
"title": true, | ||
"price": true, | ||
"rating": true, | ||
"button": true | ||
}, | ||
"properties": { | ||
"image": { | ||
"type": "boolean", | ||
"default": true | ||
}, | ||
"title": { | ||
"type": "boolean", | ||
"default": true | ||
}, | ||
"price": { | ||
"type": "boolean", | ||
"default": true | ||
}, | ||
"rating": { | ||
"type": "boolean", | ||
"default": true | ||
}, | ||
"button": { | ||
"type": "boolean", | ||
"default": true | ||
} | ||
} | ||
}, | ||
"categories": { | ||
"type": "array", | ||
"default": [] | ||
}, | ||
"catOperator": { | ||
"type": "string", | ||
"default": "any" | ||
}, | ||
"isPreview": { | ||
"type": "boolean", | ||
"default": false | ||
}, | ||
"stockStatus": { | ||
"type": "array" | ||
}, | ||
"editMode": { | ||
"type": "boolean", | ||
"default": true | ||
}, | ||
"orderby": { | ||
"type": "string", | ||
"enum": [ | ||
"date", | ||
"popularity", | ||
"price_asc", | ||
"price_desc", | ||
"rating", | ||
"title", | ||
"menu_order" | ||
], | ||
"default": "rating" | ||
} | ||
}, | ||
"textdomain": "woo-gutenberg-products-block", | ||
"apiVersion": 2, | ||
"$schema": "https://schemas.wp.org/trunk/block.json" | ||
} |
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,20 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { useBlockProps } from '@wordpress/block-editor'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { ProductTopRatedBlock } from './block'; | ||
import { Props } from './types'; | ||
|
||
export const Edit = ( props: unknown & Props ): JSX.Element => { | ||
const blockProps = useBlockProps(); | ||
|
||
return ( | ||
<div { ...blockProps }> | ||
<ProductTopRatedBlock { ...props } /> | ||
</div> | ||
); | ||
}; |
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,40 @@ | ||
interface Attributes { | ||
columns: number; | ||
rows: number; | ||
alignButtons: boolean; | ||
contentVisibility: { | ||
image: boolean; | ||
title: boolean; | ||
price: boolean; | ||
rating: boolean; | ||
button: boolean; | ||
}; | ||
categories: Array< number >; | ||
catOperator: string; | ||
isPreview: boolean; | ||
stockStatus: Array< string >; | ||
editMode: boolean; | ||
orderby: | ||
| 'date' | ||
| 'popularity' | ||
| 'price_asc' | ||
| 'price_desc' | ||
| 'rating' | ||
| 'title' | ||
| 'menu_order'; | ||
} | ||
|
||
export interface Props { | ||
/** | ||
* The attributes for this block | ||
*/ | ||
attributes: Attributes; | ||
/** | ||
* The register block name. | ||
*/ | ||
name: string; | ||
/** | ||
* A callback to update attributes | ||
*/ | ||
setAttributes: ( attributes: Partial< Attributes > ) => void; | ||
} |