-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
214 additions
and
154 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,51 @@ | ||
{ | ||
"$schema": "https://schemas.wp.org/trunk/block.json", | ||
"apiVersion": 1, | ||
"textdomain": "woo-gutenberg-products-block", | ||
"name": "woocommerce/all-products", | ||
"title": "All Products", | ||
"category": "woocommerce", | ||
"keywords": [ "WooCommerce" ], | ||
"description": "Display products from your store in a grid layout.", | ||
"supports": { | ||
"align": [ "wide", "full" ], | ||
"html": false, | ||
"multiple": false | ||
}, | ||
"example": { | ||
"attributes": { | ||
"isPreview": true | ||
} | ||
}, | ||
"attributes": { | ||
"columns": { | ||
"type": "number", | ||
"public": "true" | ||
}, | ||
"rows": { | ||
"type": "number", | ||
"public": "true" | ||
}, | ||
"alignButtons": { | ||
"type": "boolean", | ||
"public": "true" | ||
}, | ||
"contentVisibility": { | ||
"type": "object", | ||
"public": "true" | ||
}, | ||
"orderby": { | ||
"type": "string", | ||
"public": "true" | ||
}, | ||
"layoutConfig": { | ||
"type": "array", | ||
"public": "true" | ||
}, | ||
"isPreview": { | ||
"type": "boolean", | ||
"default": false, | ||
"public": "true" | ||
} | ||
} | ||
} |
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 { getSetting } from '@woocommerce/settings'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { DEFAULT_PRODUCT_LIST_LAYOUT } from '../base-utils'; | ||
|
||
export default { | ||
columns: getSetting( 'default_columns', 3 ), | ||
rows: getSetting( 'default_rows', 3 ), | ||
alignButtons: false, | ||
contentVisibility: { | ||
orderBy: true, | ||
}, | ||
orderby: 'date', | ||
layoutConfig: DEFAULT_PRODUCT_LIST_LAYOUT, | ||
isPreview: false, | ||
}; |
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,36 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { InnerBlocks } from '@wordpress/block-editor'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import metadata from './block.json'; | ||
import { getBlockClassName } from '../utils.js'; | ||
|
||
const { attributes: attributeDefinitions } = metadata; | ||
|
||
const v1 = { | ||
attributes: Object.assign( {}, attributeDefinitions, { | ||
rows: { type: 'number', default: 1 }, | ||
} ), | ||
save( { attributes } ) { | ||
const data = { | ||
'data-attributes': JSON.stringify( attributes ), | ||
}; | ||
return ( | ||
<div | ||
className={ getBlockClassName( | ||
'wc-block-all-products', | ||
attributes | ||
) } | ||
{ ...data } | ||
> | ||
<InnerBlocks.Content /> | ||
</div> | ||
); | ||
}, | ||
}; | ||
|
||
export default [ v1 ]; |
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,22 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { InnerBlocks } from '@wordpress/block-editor'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { getBlockClassName } from '../utils.js'; | ||
|
||
export default function save( { attributes } ) { | ||
return ( | ||
<div | ||
className={ getBlockClassName( | ||
'wc-block-all-products', | ||
attributes | ||
) } | ||
> | ||
<InnerBlocks.Content /> | ||
</div> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.