Files
Checkmate/client/src/Components/sidebar/Logo.tsx
T

63 lines
1.5 KiB
TypeScript
Raw Normal View History

2026-02-10 21:54:31 +00:00
import Stack, { type StackProps } from "@mui/material/Stack";
2026-02-10 19:21:57 +00:00
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
import { useTheme } from "@mui/material/styles";
import { toggleSidebar } from "@/Features/UI/uiSlice.js";
import { useDispatch } from "react-redux";
import { useTranslation } from "react-i18next";
import useSidebar from "@/Hooks/useSidebar";
import KingIcon from "@/assets/icons/checkmate-icon.svg?react";
2026-02-10 19:21:57 +00:00
2026-02-10 21:54:31 +00:00
export const Logo = (props: StackProps) => {
2026-02-10 19:21:57 +00:00
const { t } = useTranslation();
const theme = useTheme();
const dispatch = useDispatch();
const { collapsed } = useSidebar();
return (
<Stack
direction="row"
alignItems="center"
gap={theme.spacing(4)}
onClick={() => {
dispatch(toggleSidebar());
}}
sx={{ cursor: "pointer" }}
2026-02-10 21:54:31 +00:00
{...props}
2026-02-10 19:21:57 +00:00
>
<Box
sx={{
width: theme.spacing(16),
height: theme.spacing(16),
display: "flex",
justifyContent: "center",
alignItems: "center",
"& svg": {
width: "100%",
height: "100%",
},
}}
2026-02-10 19:21:57 +00:00
>
<KingIcon />
</Box>
2026-02-10 19:21:57 +00:00
<Box
overflow={"hidden"}
sx={{
transition: "opacity 900ms ease, width 900ms ease",
opacity: collapsed ? 0 : 1,
whiteSpace: "nowrap",
width: collapsed ? 0 : "100%",
}}
>
{" "}
<Typography
lineHeight={1}
mt={theme.spacing(2)}
variant="h2"
fontWeight={500}
>
{t("common.appName")}
</Typography>
</Box>
</Stack>
);
};