edit yandex button behavior

This commit is contained in:
smanylov
2026-01-14 13:26:18 +07:00
parent e53a85caa2
commit f790a95e71
2 changed files with 18 additions and 7 deletions
+14 -7
View File
@@ -12,6 +12,7 @@ declare global {
export default function YandexAuthWithScript() { export default function YandexAuthWithScript() {
const buttonRef = useRef<HTMLDivElement>(null); const buttonRef = useRef<HTMLDivElement>(null);
const [isReady, setIsReady] = useState(false); const [isReady, setIsReady] = useState(false);
const [showButton, setShowButton] = useState(true);
const handleLogin = (token: string) => { const handleLogin = (token: string) => {
console.log('handleLogin'); console.log('handleLogin');
@@ -41,6 +42,10 @@ export default function YandexAuthWithScript() {
console.log(result); console.log(result);
if (result?.access_token) { if (result?.access_token) {
handleLogin(result.access_token); handleLogin(result.access_token);
} else {
setTimeout(() => {
setShowButton(false);
}, 1000)
} }
}) })
.catch((error: any) => { .catch((error: any) => {
@@ -57,13 +62,15 @@ export default function YandexAuthWithScript() {
onError={() => console.error('Failed to load Yandex script')} onError={() => console.error('Failed to load Yandex script')}
/> />
<div {showButton && (
ref={buttonRef} <div
id="yandex-auth-container" ref={buttonRef}
className="flex justify-center" id="yandex-auth-container"
> className="flex justify-center"
{!isReady && <div>Загрузка Яндекс авторизации...</div>} >
</div> {!isReady && <div>Загрузка Яндекс авторизации...</div>}
</div>
)}
</> </>
); );
} }
+4
View File
@@ -1824,3 +1824,7 @@
width: 100% !important; width: 100% !important;
} }
} }
.yaPreloadingSuggestBlockContainer {
height: 52px !important;
}