Refactor BottomToolBar expand state handling

Moved the expand state management for BottomToolBar from internal state to props, allowing parent components to control its expanded state. Also commented out an unused conditional in DrawerControl.
This commit is contained in:
nguyentrungthat 2025-11-24 10:09:52 +07:00
parent de9e814305
commit e5bb81ef27
3 changed files with 5 additions and 3 deletions

View File

@ -510,6 +510,7 @@ function App() {
setExpanded={setExpandedBottomBar}
activeTabBottom={activeTabBottom}
setActiveTabBottom={setActiveTabBottom}
isExpand={expandedBottomBar}
/>
</Flex>
</Tabs.Panel>

View File

@ -37,6 +37,7 @@ interface TabsProps {
setExpanded: (value: React.SetStateAction<boolean>) => void;
activeTabBottom: string;
setActiveTabBottom: (value: React.SetStateAction<string>) => void;
isExpand: boolean;
}
const BottomToolBar = ({
@ -54,6 +55,7 @@ const BottomToolBar = ({
setExpanded,
setActiveTabBottom,
activeTabBottom,
isExpand,
}: TabsProps) => {
const user = useMemo(() => {
return localStorage.getItem("user") &&
@ -63,7 +65,7 @@ const BottomToolBar = ({
}, []);
const [valueInput, setValueInput] = useState<string>("");
// const [activeTabBottom, setActiveTabBottom] = useState<string>("command");
const [isExpand, setIsExpand] = useState<boolean>(true);
// const [isExpand, setIsExpand] = useState<boolean>(true);
return (
<motion.div
@ -93,7 +95,6 @@ const BottomToolBar = ({
}}
variant="light"
onClick={() => {
setIsExpand((prev) => !prev);
setExpanded((prev) => !prev);
}}
>

View File

@ -778,7 +778,7 @@ export const DrawerSwitchControl: React.FC<DrawerProps> = ({
const isOddA = numA % 2 !== 0;
const isOddB = numB % 2 !== 0;
if (numA / 48 > 1) return 0;
// if (numA / 48 > 1) return 0;
// Ưu tiên số lẻ lên trước
if (isOddA && !isOddB) return -1;