Fix website export & enhance docs page linking

This commit is contained in:
Pascal Jufer 2023-10-29 04:09:56 +01:00
parent 9789d64baf
commit 90fdaa6303
No known key found for this signature in database
4 changed files with 14 additions and 9 deletions

View file

@ -32,7 +32,9 @@ export function Header({ currentVersion }: HeaderProps) {
<HeaderCenter>
<MobileMenuContainer $visible={menuVisible}>
<NavigationItem href={'/'}>Icons</NavigationItem>
<NavigationItem href={'/docs'}>Documentation</NavigationItem>
<NavigationItem href={'/docs/introduction'} activeMatch={'/docs'}>
Documentation
</NavigationItem>
<NavigationItem href={'/support'} style={{ marginRight: 0 }}>
Donate &mdash; Our Mission
</NavigationItem>

View file

@ -7,10 +7,16 @@ import { Text15 } from './Typography';
export interface NavigationItemProps {
href: string;
activeMatch?: string;
children: React.ReactElement | string;
style?: any;
}
export function NavigationItem({ href, children, style }: NavigationItemProps) {
export function NavigationItem({
href,
activeMatch,
children,
style,
}: NavigationItemProps) {
const router = useRouter();
return (
@ -20,7 +26,9 @@ export function NavigationItem({ href, children, style }: NavigationItemProps) {
style={style}
$text={children.toString()}
$isActive={
href.slice(1)
activeMatch
? router.asPath.startsWith(activeMatch)
: href.slice(1)
? router.asPath.slice(1).startsWith(href.slice(1))
: router.asPath === href
}

View file

@ -1,5 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'export',
reactStrictMode: true,
compiler: {
styledComponents: true,
@ -7,11 +8,6 @@ const nextConfig = {
images: {
unoptimized: true,
},
async redirects() {
return [
{ source: '/docs', destination: '/docs/introduction', permanent: true },
];
},
};
module.exports = nextConfig;

View file

@ -4,7 +4,6 @@
"scripts": {
"dev": "next dev",
"build": "next build",
"export": "next export",
"start": "next start",
"lint": "next lint"
},