feat(website): social buttons in mobile menu

This commit is contained in:
Elian Doran 2025-09-27 17:37:01 +03:00
parent bdb03f8d51
commit 894ec1e3c1
No known key found for this signature in database
4 changed files with 59 additions and 32 deletions

View File

@ -12,18 +12,18 @@ footer .content-wrapper {
align-items: center; align-items: center;
} }
footer .social-buttons { .social-buttons {
display: flex; display: flex;
gap: 1em; gap: 1em;
} }
footer a.social-button { .social-buttons a.social-button {
color: var(--muted-color); color: var(--muted-color);
transition: color 250ms ease-in-out, opacity 250ms ease-in-out; transition: color 250ms ease-in-out, opacity 250ms ease-in-out;
opacity: 0.7; opacity: 0.7;
} }
footer a.social-button:hover { .social-buttons a.social-button:hover {
color: var(--brand-1); color: var(--brand-1);
opacity: 1; opacity: 1;
} }

View File

@ -15,40 +15,55 @@ export default function Footer() {
© 2017-2024 <Link href="https://github.com/zadam" openExternally>zadam</Link>. © 2017-2024 <Link href="https://github.com/zadam" openExternally>zadam</Link>.
</div> </div>
<div className="social-buttons"> <SocialButtons />
</div>
</footer>
)
}
export function SocialButtons({ className, withText }: { className?: string, withText?: boolean }) {
return (
<div className={`social-buttons ${className}`}>
<SocialButton <SocialButton
name="GitHub" name="GitHub"
iconSvg={githubIcon} iconSvg={githubIcon}
url="https://github.com/TriliumNext/Trilium" url="https://github.com/TriliumNext/Trilium"
withText={withText}
/> />
<SocialButton <SocialButton
name="GitHub Discussions" name="GitHub Discussions"
iconSvg={githubDiscussionsIcon} iconSvg={githubDiscussionsIcon}
url="https://github.com/orgs/TriliumNext/discussions" url="https://github.com/orgs/TriliumNext/discussions"
withText={withText}
/> />
<SocialButton <SocialButton
name="Matrix" name="Matrix"
iconSvg={matrixIcon} iconSvg={matrixIcon}
url="https://matrix.to/#/#triliumnext:matrix.org" url="https://matrix.to/#/#triliumnext:matrix.org"
withText={withText}
/> />
<SocialButton <SocialButton
name="Reddit" name="Reddit"
iconSvg={redditIcon} iconSvg={redditIcon}
url="https://www.reddit.com/r/Trilium/" url="https://www.reddit.com/r/Trilium/"
withText={withText}
/> />
</div> </div>
</div>
</footer>
) )
} }
function SocialButton({ name, iconSvg, url }: { name: string, iconSvg: string, url: string }) { function SocialButton({ name, iconSvg, url, withText }: { name: string, iconSvg: string, url: string, withText: boolean }) {
return ( return (
<Link className="social-button" href={url} openExternally title={name}> <Link
className="social-button"
href={url} openExternally
title={!withText ? name : undefined}
>
<Icon svg={iconSvg} /> <Icon svg={iconSvg} />
{withText && name}
</Link> </Link>
) )
} }

View File

@ -76,7 +76,7 @@ header nav a.active {
flex-direction: column; flex-direction: column;
max-height: 0; max-height: 0;
overflow: hidden; overflow: hidden;
transition: max-height 200ms ease-in-out; transition: max-height 200ms ease-in;
} }
header nav.mobile-shown { header nav.mobile-shown {
@ -91,8 +91,17 @@ header nav a.active {
border-bottom: 1px solid rgba(0, 0, 0, 0.2); border-bottom: 1px solid rgba(0, 0, 0, 0.2);
} }
header nav a:last-of-type { header .social-buttons {
justify-content: space-between;
padding-top: 1em;
}
header .social-buttons a {
border-bottom: unset; border-bottom: unset;
display: flex;
flex-direction: column;
align-items: center;
font-size: 1em;
} }
} }

View File

@ -6,6 +6,7 @@ import Icon from "./Icon";
import logoPath from "../assets/icon-color.svg"; import logoPath from "../assets/icon-color.svg";
import menuIcon from "../assets/boxicons/bx-menu.svg?raw"; import menuIcon from "../assets/boxicons/bx-menu.svg?raw";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { SocialButtons } from "./Footer";
interface HeaderLink { interface HeaderLink {
url: string; url: string;
@ -51,6 +52,8 @@ export function Header() {
target={link.external && "_blank"} target={link.external && "_blank"}
>{link.text}</a> >{link.text}</a>
))} ))}
<SocialButtons className="mobile-only" withText />
</nav> </nav>
<DownloadButton /> <DownloadButton />