feat: Корректировки 07.11.25
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useMemo, useRef, useState, type ReactElement } from "react";
|
||||
import { useEffect, useRef, useState, type ReactElement } from "react";
|
||||
import { observer } from "mobx-react-lite";
|
||||
import { languageStore } from "@shared";
|
||||
|
||||
@@ -114,7 +114,7 @@ const ArrowIcon = ({ rotation }: { rotation: number }) => (
|
||||
|
||||
const LanguageSelector = observer(
|
||||
({ onBack, isSidebarOpen = true }: LanguageSelectorProps) => {
|
||||
const { language, setLanguage } = languageStore;
|
||||
const { setLanguage } = languageStore;
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const containerRef = useRef<HTMLDivElement | null>(null);
|
||||
|
||||
@@ -145,20 +145,6 @@ const LanguageSelector = observer(
|
||||
|
||||
const toggle = () => setIsOpen((prev) => !prev);
|
||||
|
||||
const containerWidth = useMemo(() => {
|
||||
const BUTTON_SIZE = 56;
|
||||
const GAP = 8;
|
||||
const backWidth = onBack ? BUTTON_SIZE + GAP : 0;
|
||||
const toggleWidth = BUTTON_SIZE;
|
||||
const collapsedWidth = backWidth + toggleWidth + BUTTON_SIZE;
|
||||
const expandedWidth =
|
||||
backWidth +
|
||||
toggleWidth +
|
||||
LANGUAGES.length * BUTTON_SIZE +
|
||||
(LANGUAGES.length - 1) * GAP;
|
||||
return isOpen ? expandedWidth : collapsedWidth;
|
||||
}, [isOpen, onBack]);
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={containerRef}
|
||||
|
||||
Reference in New Issue
Block a user