Web: PhoneInput: added prop scaled

This commit is contained in:
Elyor Djalilov 2022-10-05 19:19:50 +05:00
parent 84f1167c49
commit 2c71e239b1
4 changed files with 7 additions and 9 deletions

View File

@ -26,8 +26,6 @@ const InputPhone = (props) => {
const str = e.target.value.replace(/\s/g, "");
const el = options.find((option) => option.dialCode === str);
console.log(phoneValue);
if (e.target.value === "" || phoneValue) {
setIsValid(false);
setCountry((prev) => ({ ...prev, icon: InvalidFlag }));
@ -112,7 +110,7 @@ const InputPhone = (props) => {
hasError={!isValid}
displayProp="flex"
alignItems="center"
scale={props.scale}
scaled={props.scaled}
>
<ComboBox
onClick={handleClick}
@ -192,8 +190,8 @@ InputPhone.propTypes = {
phonePlaceholderText: PropTypes.string,
/** Text displayed on the SearchInput placeholder */
searchPlaceholderText: PropTypes.string,
/** Indicates the input field has scale */
scale: PropTypes.bool,
/** Indicates the input field has scaled */
scaled: PropTypes.bool,
/** Called when value is changed */
onChange: PropTypes.func,
/** Gets the country mask */
@ -211,7 +209,7 @@ InputPhone.defaultProps = {
},
phonePlaceholderText: "",
searchPlaceholderText: "",
scale: false,
scaled: false,
searchEmptyMessage: "",
errorMessage: "",
};

View File

@ -36,7 +36,7 @@ Default.args = {
},
phonePlaceholderText: "7 XXX XXX-XX-XX",
searchPlaceholderText: "Search",
scale: false,
scaled: false,
searchEmptyMessage: "Nothing found",
errorMessage: "Сountry code is invalid",
};

View File

@ -4,7 +4,7 @@ import Base from "../themes/base";
export const StyledBox = styled(Box)`
position: relative;
width: ${(props) => (props.scale ? "100%" : props.theme.inputPhone.width)};
width: ${(props) => (props.scaled ? "100%" : props.theme.inputPhone.width)};
border: 1px solid ${(props) =>
props.hasError
? props.theme.inputPhone.errorBorderColor

View File

@ -45,7 +45,7 @@ Default.args = {
isReadOnly: false,
hasError: false,
hasWarning: false,
scale: false,
scaled: false,
autoComplete: "off",
tabIndex: 1,
withBorder: true,