react-icons/hi#HiOutlineTranslate TypeScript Examples
The following examples show how to use
react-icons/hi#HiOutlineTranslate.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UserBox.tsx From tobira with Apache License 2.0 | 5 votes |
Menu: React.FC<MenuProps> = ({ close, container }) => {
const { t } = useTranslation();
type State = "main" | "language";
const [state, setState] = useState<State>("main");
const userState = useUser();
const user = userState === "none" || userState === "unknown" ? null : userState;
// Close menu on clicks anywhere outside of it.
useOnOutsideClick(container, close);
const items = match(state, {
main: () => <>
{/* Login button if the user is NOT logged in */}
{!user && (
<MenuItem
icon={<FiLogIn />}
borderBottom
linkTo={CONFIG.auth.loginLink ?? LOGIN_PATH}
htmlLink={!!CONFIG.auth.loginLink}
css={{
color: "var(--nav-color)",
[`@media not all and (max-width: ${BREAKPOINT_MEDIUM}px)`]: {
display: "none",
},
}}
>{t("user.login")}</MenuItem>
)}
{user && <>
{user.canUpload && <MenuItem
icon={<FiUpload />}
linkTo={"/~upload"}
onClick={() => close()}
>{t("upload.title")}</MenuItem>}
<MenuItem
icon={<FiFilm />}
linkTo="/~manage"
onClick={() => close()}
>{t("user.manage-content")}</MenuItem>
</>}
<MenuItem icon={<HiOutlineTranslate />} onClick={() => setState("language")}>
{t("language")}
</MenuItem>
{/* Logout button if the user is logged in */}
{user && <Logout />}
</>,
language: () => <>
<MenuItem icon={<FiChevronLeft />} onClick={() => setState("main")} borderBottom>
{t("back")}
</MenuItem>
<LanguageMenu />
</>,
});
return (
<ul css={{
position: "absolute",
zIndex: 1000,
top: "100%",
right: 8,
marginTop: 8,
borderRadius: 4,
border: "1px solid var(--grey80)",
boxShadow: "1px 1px 5px var(--grey92)",
backgroundColor: "white",
minWidth: 200,
paddingLeft: 0,
margin: 0,
overflow: "hidden",
}}>{items}</ul>
);
}