2024-09-15 14:51:01 -05:00
|
|
|
---
|
2026-11-17 23:48:31 -06:00
|
|
|
import { GearIcon } from "@radix-ui/react-icons";
|
|
|
|
|
import { api } from "../api/dynamic";
|
2025-09-13 22:53:29 -05:00
|
|
|
import { tools } from "../constants/tools";
|
2026-11-17 23:48:31 -06:00
|
|
|
import type { LocaleAcceptorProps } from "../hooks/useLocale";
|
|
|
|
|
import { Logo } from "../icons/Logo";
|
|
|
|
|
import { LinkI18nWrapper } from "./LinkI18nWrapper";
|
|
|
|
|
import { Text } from "./Text";
|
2024-09-15 14:51:01 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
type Props = LocaleAcceptorProps;
|
2025-05-06 21:30:35 -05:00
|
|
|
|
2025-10-22 17:52:01 -05:00
|
|
|
const { locale } = Astro.props;
|
2026-11-17 23:48:31 -06:00
|
|
|
|
|
|
|
|
const strings = await api.strings(locale);
|
|
|
|
|
|
|
|
|
|
const filtered = Object.values(tools).filter(
|
|
|
|
|
(tool) => !tool.href && (tool.navbar ?? true),
|
|
|
|
|
);
|
2024-09-15 14:51:01 -05:00
|
|
|
---
|
|
|
|
|
|
|
|
|
|
<style>
|
2026-11-17 23:48:31 -06:00
|
|
|
#navbar {
|
|
|
|
|
--icon-size: 1.5rem;
|
|
|
|
|
--padding: var(--space-4);
|
|
|
|
|
--min-content-width: calc(var(--icon-size) + 2 * var(--padding));
|
2025-05-06 13:29:40 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
width: var(--min-content-width);
|
2025-05-06 13:29:40 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
.expander {
|
|
|
|
|
background-color: var(--gray-1);
|
2025-05-06 13:29:40 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
z-index: 1;
|
2024-09-15 14:51:01 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
position: relative;
|
|
|
|
|
left: 0;
|
2025-04-03 13:00:23 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
padding: var(--padding);
|
|
|
|
|
padding-top: calc(var(--padding) + var(--space-3));
|
2025-04-24 20:07:17 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
justify-content: space-between;
|
2025-10-20 22:13:14 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
box-sizing: border-box;
|
2025-10-20 22:13:14 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
transition-duration: var(--duration-brief);
|
2025-10-20 22:13:14 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
height: 100%;
|
|
|
|
|
width: var(--min-content-width);
|
|
|
|
|
overflow: hidden;
|
2025-04-24 20:07:17 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
&:hover {
|
|
|
|
|
width: fit-content;
|
|
|
|
|
|
|
|
|
|
padding-right: calc(2 * var(--padding));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.logo {
|
|
|
|
|
width: var(--icon-size);
|
|
|
|
|
height: var(--icon-size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.named-link {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: var(--space-3);
|
|
|
|
|
|
|
|
|
|
.icon {
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
|
|
|
|
width: var(--icon-size);
|
|
|
|
|
height: var(--icon-size);
|
|
|
|
|
|
|
|
|
|
color: var(--gray-11);
|
|
|
|
|
|
|
|
|
|
transition-duration: var(--duration-brief);
|
|
|
|
|
|
|
|
|
|
.expander:hover & {
|
|
|
|
|
color: var(--gray-12);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.name {
|
|
|
|
|
transition-duration: var(--duration-brief);
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
|
|
|
|
.expander:not(:hover) & {
|
|
|
|
|
opacity: 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.tools {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: var(--space-3);
|
|
|
|
|
|
|
|
|
|
.tool {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: var(--space-3);
|
|
|
|
|
|
|
|
|
|
.logo {
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
|
|
|
|
transition-duration: var(--duration-brief);
|
|
|
|
|
|
|
|
|
|
width: var(--icon-size);
|
|
|
|
|
height: var(--icon-size);
|
|
|
|
|
|
|
|
|
|
filter: saturate(0.5);
|
|
|
|
|
background-size: cover;
|
|
|
|
|
background-position: center;
|
|
|
|
|
|
|
|
|
|
border-radius: var(--radius-max);
|
|
|
|
|
|
|
|
|
|
.expander:hover & {
|
|
|
|
|
width: calc(2 * var(--icon-size));
|
|
|
|
|
border-radius: var(--radius-max);
|
|
|
|
|
|
|
|
|
|
filter: saturate(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.overlay {
|
|
|
|
|
position: fixed;
|
|
|
|
|
inset: 0;
|
|
|
|
|
|
|
|
|
|
z-index: 1;
|
|
|
|
|
pointer-events: none;
|
|
|
|
|
|
|
|
|
|
background-color: transparent;
|
|
|
|
|
|
|
|
|
|
transition-duration: var(--duration-brief);
|
|
|
|
|
|
|
|
|
|
#navbar:hover & {
|
|
|
|
|
background-color: var(--black-a8);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-09-15 14:51:01 -05:00
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
<nav id="navbar">
|
|
|
|
|
<div class="overlay" />
|
2024-09-15 14:51:01 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
<div class="expander">
|
|
|
|
|
<LinkI18nWrapper {locale} href="/settings">
|
|
|
|
|
<div class="named-link">
|
|
|
|
|
<Logo className="icon" />
|
|
|
|
|
<Text className="name">{strings.common.name}</Text>
|
|
|
|
|
</div>
|
|
|
|
|
</LinkI18nWrapper>
|
2024-09-15 14:51:01 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
<div class="tools">
|
|
|
|
|
{filtered.map((tool) => (
|
|
|
|
|
<>
|
|
|
|
|
<LinkI18nWrapper {locale} href={`/${tool.slug ?? tool.id}`}>
|
|
|
|
|
<div class="tool">
|
|
|
|
|
<div
|
|
|
|
|
style={`background-image: url(/media/tools/banners/${tool.slug ?? tool.id}.webp)`}
|
|
|
|
|
class="logo"
|
|
|
|
|
/>
|
2024-09-15 14:51:01 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
<Text className="name">
|
|
|
|
|
{strings.tools[tool.id as keyof typeof strings.tools].name}
|
|
|
|
|
</Text>
|
|
|
|
|
</div>
|
|
|
|
|
</LinkI18nWrapper>
|
|
|
|
|
</>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
2025-04-03 12:45:33 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
<LinkI18nWrapper {locale} href="/settings">
|
|
|
|
|
<div class="named-link">
|
|
|
|
|
<GearIcon className="icon" />
|
|
|
|
|
<Text className="name">{strings.navbar.settings}</Text>
|
|
|
|
|
</div>
|
|
|
|
|
</LinkI18nWrapper>
|
|
|
|
|
</div>
|
|
|
|
|
</nav>
|