fix: merge style bugs
This commit is contained in:
@@ -12,6 +12,7 @@ import { CountDownTimer } from '@/components/CountDownTimer';
|
||||
import { CountryCodeSelector } from '../../CountryCodeSelector';
|
||||
import { Icon } from '@rkheftan/harmony-ui';
|
||||
import { type PhoneEditFormProps } from '@/features/profile/types/settingsType';
|
||||
import { useState } from 'react';
|
||||
|
||||
export default function PhoneEditForm({
|
||||
phoneNumber,
|
||||
@@ -39,6 +40,8 @@ export default function PhoneEditForm({
|
||||
return digitsOnly.length >= 8 && digitsOnly.length <= 15;
|
||||
};
|
||||
|
||||
const [isSending, setIsSending] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box sx={{ width: '100%' }}>
|
||||
@@ -73,7 +76,7 @@ export default function PhoneEditForm({
|
||||
error={inputError}
|
||||
helperText={inputError ? error : ''}
|
||||
onChange={(e) => setPhoneNumber(e.target.value)}
|
||||
sx={{ flex: '1 1 220px', minWidth: 0 }}
|
||||
sx={{ flex: '1 1 220px' }}
|
||||
placeholder="09123456789"
|
||||
InputProps={{
|
||||
endAdornment:
|
||||
@@ -122,12 +125,18 @@ export default function PhoneEditForm({
|
||||
) : (
|
||||
<Button
|
||||
variant="text"
|
||||
onClick={() => {
|
||||
onClick={async () => {
|
||||
if (isValidPhoneNumber(phoneNumber)) {
|
||||
handleSendCode();
|
||||
setIsSending(true);
|
||||
try {
|
||||
await handleSendCode();
|
||||
} finally {
|
||||
setIsSending(false);
|
||||
}
|
||||
}
|
||||
}}
|
||||
disabled={
|
||||
isSending ||
|
||||
buttonState === 'counting' ||
|
||||
phoneNumber.length === 0 ||
|
||||
!isValidPhoneNumber(phoneNumber)
|
||||
@@ -138,7 +147,9 @@ export default function PhoneEditForm({
|
||||
textTransform: 'none',
|
||||
}}
|
||||
>
|
||||
{buttonState === 'counting' ? (
|
||||
{isSending ? (
|
||||
<CircularProgress size={20} />
|
||||
) : buttonState === 'counting' ? (
|
||||
<CountDownTimer
|
||||
initialSeconds={60}
|
||||
onComplete={() => setButtonState('default')}
|
||||
|
||||
Reference in New Issue
Block a user