From 73ef12db7209a53b76dcaa91f5da22eaefb1242e Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Mon, 27 Feb 2023 10:44:52 +0100 Subject: [PATCH] :recycle: Better phone input props pass --- packages/js/src/components/InputChatBlock.tsx | 5 ++++- .../inputs/phone/components/PhoneInput.tsx | 19 ++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/js/src/components/InputChatBlock.tsx b/packages/js/src/components/InputChatBlock.tsx index 290cbbd30..4afc44444 100644 --- a/packages/js/src/components/InputChatBlock.tsx +++ b/packages/js/src/components/InputChatBlock.tsx @@ -146,7 +146,10 @@ const Input = (props: { & { defaultValue?: string onSubmit: (value: InputSubmitContent) => void hasGuestAvatar: boolean } export const PhoneInput = (props: PhoneInputProps) => { - // eslint-disable-next-line solid/reactivity - const defaultCountryCode = props.block.options.defaultCountryCode - const [selectedCountryCode, setSelectedCountryCode] = createSignal( - isEmpty(defaultCountryCode) ? 'INT' : defaultCountryCode + isEmpty(props.defaultCountryCode) ? 'INT' : props.defaultCountryCode ) const [inputValue, setInputValue] = createSignal(props.defaultValue ?? '') let inputRef: HTMLInputElement | undefined @@ -102,9 +101,7 @@ export const PhoneInput = (props: PhoneInputProps) => { ref={inputRef} value={inputValue()} onInput={handleInput} - placeholder={ - props.block.options.labels.placeholder ?? 'Your phone number...' - } + placeholder={props.labels.placeholder ?? 'Your phone number...'} autofocus={!isMobile()} /> @@ -115,7 +112,7 @@ export const PhoneInput = (props: PhoneInputProps) => { class="my-2 ml-2" on:click={submit} > - {props.block.options?.labels?.button ?? 'Send'} + {props.labels?.button ?? 'Send'} )