Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Add fill and outline styles to the start shopping button
Browse files Browse the repository at this point in the history
  • Loading branch information
albarin committed Mar 23, 2023
1 parent 60485ec commit 60929d4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@
}
}
},
"styles": [
{
"name": "fill",
"label": "Fill",
"isDefault": true
},
{
"name": "outline",
"label": "Outline"
}
],
"parent": [ "woocommerce/empty-mini-cart-contents-block" ],
"textdomain": "woo-gutenberg-products-block",
"apiVersion": 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,18 @@ const Block = ( {
return null;
}

const variant = className.includes( 'is-style-outline' )
? 'outlined'
: 'contained';

return (
<div className="wp-block-button has-text-align-center">
<Button
className={ classNames(
className,
'wc-block-mini-cart__shopping-button'
) }
variant={ variant }
href={ SHOP_URL }
>
{ startShoppingButtonLabel || defaultStartShoppingButtonLabel }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export const Edit = ( {
const blockProps = useBlockProps();
const { startShoppingButtonLabel } = attributes;

const variant = blockProps.className.includes( 'is-style-outline' )
? 'outlined'
: 'contained';

return (
<div className="wp-block-button aligncenter">
<EditableButton
Expand All @@ -33,6 +37,7 @@ export const Edit = ( {
startShoppingButtonLabel: content,
} );
} }
variant={ variant }
/>
</div>
);
Expand Down

0 comments on commit 60929d4

Please sign in to comment.