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 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Order confirmation: Convert Order Details Templates to Blocks (#10095)
* Move code from templates into the details block * Details -> Totals * Downloads block * Sample content for downloads block * Add block icon
- Loading branch information
1 parent
daebed2
commit 3d117e1
Showing
13 changed files
with
547 additions
and
166 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
...cks/order-confirmation/details/block.json → ...s/order-confirmation/downloads/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,43 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import ServerSideRender from '@wordpress/server-side-render'; | ||
import { useBlockProps } from '@wordpress/block-editor'; | ||
import { Disabled } from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import './style.scss'; | ||
|
||
interface Props { | ||
attributes: { | ||
align: string; | ||
className: string; | ||
isPreview: boolean; | ||
}; | ||
name: string; | ||
} | ||
|
||
const Edit = ( props: Props ): JSX.Element => { | ||
const { attributes, name } = props; | ||
const blockProps = useBlockProps( { | ||
className: 'wc-block-order-confirmation-downloads', | ||
} ); | ||
|
||
return ( | ||
<div { ...blockProps }> | ||
<Disabled> | ||
<ServerSideRender | ||
block={ name } | ||
attributes={ { | ||
...attributes, | ||
isPreview: true, | ||
} } | ||
/> | ||
</Disabled> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Edit; |
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,30 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { registerBlockType } from '@wordpress/blocks'; | ||
import { Icon, download } from '@wordpress/icons'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import metadata from './block.json'; | ||
import edit from './edit'; | ||
import './style.scss'; | ||
|
||
registerBlockType( metadata, { | ||
icon: { | ||
src: ( | ||
<Icon | ||
icon={ download } | ||
className="wc-block-editor-components-block-icon" | ||
/> | ||
), | ||
}, | ||
attributes: { | ||
...metadata.attributes, | ||
}, | ||
edit, | ||
save() { | ||
return null; | ||
}, | ||
} ); |
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,27 @@ | ||
.wc-block-order-confirmation-downloads { | ||
.woocommerce-order-downloads table, | ||
.woocommerce-order-downloads table.shop_table { | ||
width: 100%; | ||
border: 1px solid currentColor; | ||
border-bottom: 0; | ||
|
||
thead { | ||
text-transform: uppercase; | ||
} | ||
|
||
th { | ||
font-weight: bold; | ||
} | ||
|
||
th, | ||
td { | ||
border-style: solid; | ||
border-color: currentColor; | ||
border-width: 0 0 1px 0; | ||
padding: $gap-small; | ||
margin: 0; | ||
text-align: left; | ||
} | ||
} | ||
} | ||
|
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,29 @@ | ||
{ | ||
"name": "woocommerce/order-confirmation-totals", | ||
"version": "1.0.0", | ||
"title": "Order Totals", | ||
"description": "Display the items purchased and order totals.", | ||
"category": "woocommerce", | ||
"keywords": [ "WooCommerce" ], | ||
"supports": { | ||
"multiple": false, | ||
"align": [ "wide", "full" ] | ||
}, | ||
"attributes": { | ||
"align": { | ||
"type": "string", | ||
"default": "wide" | ||
}, | ||
"className": { | ||
"type": "string", | ||
"default": "" | ||
}, | ||
"isPreview": { | ||
"type": "boolean", | ||
"default": false | ||
} | ||
}, | ||
"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
File renamed without changes.
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.