* Set min-height to 0 for Country & State hidden inputs

* Fix button styles broken in the Cart block in editor

* Avoid having editor.scss specific stylesheets for button and totals

* Move Button inside cart-checkout subfolder
This commit is contained in:
Albert Juhé Lluveras 2020-03-13 13:02:08 +01:00 committed by GitHub
parent 47025baeb2
commit 1c81066bc4
12 changed files with 49 additions and 37 deletions

View File

@ -1,20 +0,0 @@
// Extra classes are added for specificity.
.button.wc-block-button,
.editor-styles-wrapper .button.wc-block-button {
background-color: #000;
color: #fff;
display: block;
font-size: inherit;
font-weight: bold;
padding: $gap-small;
text-align: center;
text-decoration: none;
text-transform: none;
&:hover,
&:focus,
&:active {
background-color: $black;
color: #fff;
}
}

View File

@ -8,4 +8,8 @@ export default {
component: Button, component: Button,
}; };
export const Default = () => <Button>Buy now</Button>; export const Default = () => (
<div className="wc-block-cart">
<Button>Buy now</Button>
</div>
);

View File

@ -0,0 +1,24 @@
// Extra classes are added for specificity.
.wc-block-cart,
.wc-block-checkout {
.button.wc-block-button {
background-color: #000 !important;
color: #fff !important;
display: block;
font-size: inherit;
font-weight: bold;
height: 48px; // same height as text-input
line-height: 1;
padding: $gap-small;
text-align: center;
text-decoration: none;
text-transform: none;
&:hover,
&:focus,
&:active {
background-color: $black !important;
color: #fff !important;
}
}
}

View File

@ -0,0 +1 @@
export { default as Button } from './button';

View File

@ -47,6 +47,7 @@ const CountryInput = ( {
onChange( foundOption ? foundOption.key : '' ); onChange( foundOption ? foundOption.key : '' );
} } } }
style={ { style={ {
minHeight: '0',
height: '0', height: '0',
border: '0', border: '0',
padding: '0', padding: '0',

View File

@ -3,7 +3,7 @@
*/ */
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { __ } from '@wordpress/i18n'; import { __ } from '@wordpress/i18n';
import Button from '@woocommerce/base-components/button'; import { Button } from '@woocommerce/base-components/cart-checkout';
import { useState } from '@wordpress/element'; import { useState } from '@wordpress/element';
import isShallowEqual from '@wordpress/is-shallow-equal'; import isShallowEqual from '@wordpress/is-shallow-equal';

View File

@ -79,6 +79,7 @@ const StateInput = ( {
onChangeState( event.target.value ) onChangeState( event.target.value )
} }
style={ { style={ {
minHeight: '0',
height: '0', height: '0',
border: '0', border: '0',
padding: '0', padding: '0',

View File

@ -4,7 +4,7 @@
import { __ } from '@wordpress/i18n'; import { __ } from '@wordpress/i18n';
import { useState, useEffect, useRef } from '@wordpress/element'; import { useState, useEffect, useRef } from '@wordpress/element';
import { PanelBody, PanelRow } from 'wordpress-components'; import { PanelBody, PanelRow } from 'wordpress-components';
import Button from '@woocommerce/base-components/button'; import { Button } from '@woocommerce/base-components/cart-checkout';
import TextInput from '@woocommerce/base-components/text-input'; import TextInput from '@woocommerce/base-components/text-input';
import Label from '@woocommerce/base-components/label'; import Label from '@woocommerce/base-components/label';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
@ -13,8 +13,8 @@ import { withInstanceId } from 'wordpress-compose';
/** /**
* Internal dependencies * Internal dependencies
*/ */
import './style.scss';
import LoadingMask from '../../loading-mask'; import LoadingMask from '../../loading-mask';
import './style.scss';
const TotalsCouponCodeInput = ( { const TotalsCouponCodeInput = ( {
instanceId, instanceId,

View File

@ -1,17 +1,18 @@
.wc-block-coupon-code__form { .wc-block-coupon-code__form {
display: flex; display: flex;
margin-bottom: 0; margin-bottom: 0;
}
.wc-block-coupon-code__input { .wc-block-coupon-code__input {
margin-top: 0; margin-top: 0;
flex-grow: 1; flex-grow: 1;
} }
.wc-block-coupon-code__button { .wc-block-coupon-code__button {
height: 48px; height: 48px;
margin-left: $gap; flex-shrink: 0;
padding-left: $gap-large; margin-left: $gap;
padding-right: $gap-large; padding-left: $gap-large;
white-space: nowrap; padding-right: $gap-large;
white-space: nowrap;
}
} }

View File

@ -2,7 +2,7 @@
* External dependencies * External dependencies
*/ */
import { __ } from '@wordpress/i18n'; import { __ } from '@wordpress/i18n';
import Button from '@woocommerce/base-components/button'; import { Button } from '@woocommerce/base-components/cart-checkout';
import { CHECKOUT_URL } from '@woocommerce/block-settings'; import { CHECKOUT_URL } from '@woocommerce/block-settings';
/** /**

View File

@ -92,7 +92,7 @@ const Block = ( {
return ( return (
<CheckoutProvider isEditor={ isEditor }> <CheckoutProvider isEditor={ isEditor }>
<SidebarLayout> <SidebarLayout className="wc-block-checkout">
<Main> <Main>
<ExpressCheckoutFormControl /> <ExpressCheckoutFormControl />
<CheckoutForm> <CheckoutForm>