|
import React from "react"; |
|
import { Box, Typography, IconButton, Tooltip } from "@mui/material"; |
|
import OpenInNewIcon from "@mui/icons-material/OpenInNew"; |
|
import ShareIcon from "@mui/icons-material/Share"; |
|
import DarkModeOutlinedIcon from "@mui/icons-material/DarkModeOutlined"; |
|
import LightModeOutlinedIcon from "@mui/icons-material/LightModeOutlined"; |
|
import { useThemeMode } from "../hooks/useThemeMode"; |
|
|
|
const ExternalLinks = () => { |
|
const { mode, toggleTheme } = useThemeMode(); |
|
|
|
const handleShare = async () => { |
|
try { |
|
await navigator.share({ |
|
title: "YourBench Demo", |
|
text: "Check out this benchmark evaluation on YourBench!", |
|
url: window.location.href, |
|
}); |
|
} catch (err) { |
|
console.log("Error sharing:", err); |
|
} |
|
}; |
|
|
|
return ( |
|
<Box |
|
sx={{ |
|
position: "fixed", |
|
top: 24, |
|
left: 24, |
|
right: 24, |
|
margin: "auto", |
|
display: "flex", |
|
justifyContent: "space-between", |
|
alignItems: "center", |
|
zIndex: 1000, |
|
}} |
|
> |
|
<Typography |
|
variant="body2" |
|
sx={{ |
|
display: "flex", |
|
gap: 2, |
|
alignItems: "center", |
|
}} |
|
> |
|
<a |
|
href="https://github.com/huggingface/yourbench" |
|
target="_blank" |
|
rel="noopener noreferrer" |
|
style={{ textDecoration: "none", color: "inherit" }} |
|
> |
|
GitHub |
|
<OpenInNewIcon sx={{ fontSize: "0.75rem", ml: 0.5, opacity: 0.6 }} /> |
|
</a> |
|
<Typography component="span" sx={{ opacity: 0.5 }}> |
|
• |
|
</Typography> |
|
<a |
|
href="https://huggingface.co/datasets/sumuks/tempora" |
|
target="_blank" |
|
rel="noopener noreferrer" |
|
style={{ textDecoration: "none", color: "inherit" }} |
|
> |
|
Dataset |
|
<OpenInNewIcon sx={{ fontSize: "0.75rem", ml: 0.5, opacity: 0.6 }} /> |
|
</a> |
|
<Typography component="span" sx={{ opacity: 0.5 }}> |
|
• |
|
</Typography> |
|
<a |
|
href="https://github.com/huggingface/yourbench/tree/main/docs" |
|
target="_blank" |
|
rel="noopener noreferrer" |
|
style={{ textDecoration: "none", color: "inherit" }} |
|
> |
|
Documentation |
|
<OpenInNewIcon sx={{ fontSize: "0.75rem", ml: 0.5, opacity: 0.6 }} /> |
|
</a> |
|
<Typography component="span" sx={{ opacity: 0.5 }}> |
|
• |
|
</Typography> |
|
<a |
|
href="https://huggingface.co/spaces/yourbench/yourbench-demo" |
|
target="_blank" |
|
rel="noopener noreferrer" |
|
style={{ textDecoration: "none", color: "inherit" }} |
|
> |
|
Full demo |
|
<OpenInNewIcon sx={{ fontSize: "0.75rem", ml: 0.5, opacity: 0.6 }} /> |
|
</a> |
|
</Typography> |
|
<Box sx={{ display: "flex", alignItems: "center" }}> |
|
<Tooltip title="Share"> |
|
<IconButton |
|
onClick={handleShare} |
|
size="small" |
|
sx={{ |
|
color: "inherit", |
|
opacity: 0.7, |
|
"&:hover": { |
|
opacity: 1, |
|
}, |
|
}} |
|
> |
|
<ShareIcon fontSize="small" /> |
|
</IconButton> |
|
</Tooltip> |
|
<Tooltip title={mode === "light" ? "Mode sombre" : "Mode clair"}> |
|
<IconButton |
|
onClick={toggleTheme} |
|
size="small" |
|
sx={{ |
|
ml: 1, |
|
color: "inherit", |
|
opacity: 0.7, |
|
"&:hover": { |
|
opacity: 1, |
|
}, |
|
}} |
|
> |
|
{mode === "light" ? ( |
|
<DarkModeOutlinedIcon fontSize="small" /> |
|
) : ( |
|
<LightModeOutlinedIcon fontSize="small" /> |
|
)} |
|
</IconButton> |
|
</Tooltip> |
|
</Box> |
|
</Box> |
|
); |
|
}; |
|
|
|
export default ExternalLinks; |
|
|