Files
kiss-translator/src/views/Popup/Header.js

50 lines
1.2 KiB
JavaScript
Raw Normal View History

2023-09-04 22:03:17 +08:00
import IconButton from "@mui/material/IconButton";
import CloseIcon from "@mui/icons-material/Close";
import HomeIcon from "@mui/icons-material/Home";
import Stack from "@mui/material/Stack";
import DarkModeButton from "../Options/DarkModeButton";
2023-11-22 10:23:14 +08:00
import Typography from "@mui/material/Typography";
2023-09-04 22:03:17 +08:00
2025-10-21 02:07:33 +08:00
export default function Header({ onClose }) {
2023-09-04 22:03:17 +08:00
const handleHomepage = () => {
window.open(process.env.REACT_APP_HOMEPAGE, "_blank");
};
return (
<Stack
direction="row"
justifyContent="space-between"
alignItems="center"
spacing={2}
>
<Stack direction="row" justifyContent="flex-start" alignItems="center">
<IconButton onClick={handleHomepage}>
<HomeIcon />
</IconButton>
2023-11-22 10:23:14 +08:00
<Typography
component="div"
2023-09-12 17:20:56 +08:00
sx={{
userSelect: "none",
WebkitUserSelect: "none",
2023-11-22 10:23:14 +08:00
fontWeight: "bold",
2023-09-12 17:20:56 +08:00
}}
>
2023-09-04 22:03:17 +08:00
{`${process.env.REACT_APP_NAME} v${process.env.REACT_APP_VERSION}`}
2023-11-22 10:23:14 +08:00
</Typography>
2023-09-04 22:03:17 +08:00
</Stack>
2025-10-21 02:07:33 +08:00
{onClose ? (
2023-09-04 22:03:17 +08:00
<IconButton
onClick={() => {
2025-10-21 02:07:33 +08:00
onClose();
2023-09-04 22:03:17 +08:00
}}
>
<CloseIcon />
</IconButton>
) : (
<DarkModeButton />
)}
</Stack>
);
}