edit yandex button behavior
This commit is contained in:
@@ -12,6 +12,7 @@ declare global {
|
||||
export default function YandexAuthWithScript() {
|
||||
const buttonRef = useRef<HTMLDivElement>(null);
|
||||
const [isReady, setIsReady] = useState(false);
|
||||
const [showButton, setShowButton] = useState(true);
|
||||
|
||||
const handleLogin = (token: string) => {
|
||||
console.log('handleLogin');
|
||||
@@ -41,6 +42,10 @@ export default function YandexAuthWithScript() {
|
||||
console.log(result);
|
||||
if (result?.access_token) {
|
||||
handleLogin(result.access_token);
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
setShowButton(false);
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
.catch((error: any) => {
|
||||
@@ -57,13 +62,15 @@ export default function YandexAuthWithScript() {
|
||||
onError={() => console.error('Failed to load Yandex script')}
|
||||
/>
|
||||
|
||||
<div
|
||||
ref={buttonRef}
|
||||
id="yandex-auth-container"
|
||||
className="flex justify-center"
|
||||
>
|
||||
{!isReady && <div>Загрузка Яндекс авторизации...</div>}
|
||||
</div>
|
||||
{showButton && (
|
||||
<div
|
||||
ref={buttonRef}
|
||||
id="yandex-auth-container"
|
||||
className="flex justify-center"
|
||||
>
|
||||
{!isReady && <div>Загрузка Яндекс авторизации...</div>}
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1824,3 +1824,7 @@
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
|
||||
.yaPreloadingSuggestBlockContainer {
|
||||
height: 52px !important;
|
||||
}
|
||||
Reference in New Issue
Block a user