* add input type

* fix css issues with types and better change default position
This commit is contained in:
Seghir Nadir 2019-12-19 13:59:34 +01:00 committed by GitHub
parent cf495a775e
commit aaddf13494
3 changed files with 12 additions and 5 deletions

View File

@ -14,6 +14,7 @@ import './style.scss';
const TextInput = ( {
className,
id,
type = 'text',
ariaLabel,
label,
screenReaderLabel,
@ -40,7 +41,7 @@ const TextInput = ( {
htmlFor={ id }
/>
<input
type="text"
type={ type }
id={ id }
value={ value }
onChange={ onChangeValue }

View File

@ -16,8 +16,10 @@
transform: translateX(#{$gap - $gap-small}) translateY(#{$gap-smallest}) scale(0.75);
transition: all 200ms ease;
}
.wc-blocks-text-input input[type="text"] {
.wc-blocks-text-input input[type="tel"],
.wc-blocks-text-input input[type="url"],
.wc-blocks-text-input input[type="text"],
.wc-blocks-text-input input[type="email"] {
padding: $gap-small $gap;
border-radius: 4px;
border: 1px solid $input-border-gray;
@ -30,7 +32,9 @@
height: 48px;
color: $input-text-active;
}
.wc-blocks-text-input.is-active input[type="text"] {
.wc-blocks-text-input.is-active input[type="tel"],
.wc-blocks-text-input.is-active input[type="url"],
.wc-blocks-text-input.is-active input[type="text"],
.wc-blocks-text-input.is-active input[type="email"] {
padding: $gap-large $gap $gap-smallest;
}

View File

@ -51,6 +51,7 @@ const Block = ( { shippingMethods = [], isEditor = false } ) => {
>
<TextInput
id="email-field"
type="email"
label={ __(
'Email address',
'woo-gutenberg-products-block'
@ -230,6 +231,7 @@ const Block = ( { shippingMethods = [], isEditor = false } ) => {
</InputRow>
<TextInput
id="shipping-phone"
type="tel"
label={ __(
'Phone',
'woo-gutenberg-products-block'