* 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,
};
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 : '' );
} }
style={ {
minHeight: '0',
height: '0',
border: '0',
padding: '0',

View File

@ -3,7 +3,7 @@
*/
import PropTypes from 'prop-types';
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 isShallowEqual from '@wordpress/is-shallow-equal';

View File

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

View File

@ -4,7 +4,7 @@
import { __ } from '@wordpress/i18n';
import { useState, useEffect, useRef } from '@wordpress/element';
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 Label from '@woocommerce/base-components/label';
import PropTypes from 'prop-types';
@ -13,8 +13,8 @@ import { withInstanceId } from 'wordpress-compose';
/**
* Internal dependencies
*/
import './style.scss';
import LoadingMask from '../../loading-mask';
import './style.scss';
const TotalsCouponCodeInput = ( {
instanceId,

View File

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

View File

@ -2,7 +2,7 @@
* External dependencies
*/
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';
/**

View File

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