Create legal pages and refactor navigation

New pages for Cookie Policy, Terms of Service, and Privacy Policy were added. The navigation system was restructured using a mapped array of links instead of hard coded components. The 'Not Found' page's metadata handling was improved and its translation was updated. Certain components that aid this refactoring were created and some pre-existing components or functions were moved to more appropriate locations or renamed for clarity. The Site Navigation, Footer, and Page header components were updated in layout and content. Various pages including Blog and Documentation were updated or removed.
This commit is contained in:
giancarlo
2024-04-04 10:04:07 +08:00
parent 2782b26dc2
commit 0b374c558a
18 changed files with 178 additions and 186 deletions

View File

@@ -12,7 +12,7 @@ import { isBrowser } from '@kit/shared/utils';
import { Button } from '@kit/ui/button';
import { Heading } from '@kit/ui/heading';
import { If } from '@kit/ui/if';
import { cn } from '@kit/ui/utils';
import { cn, isRouteActive } from '@kit/ui/utils';
const DocsNavLink: React.FC<{
label: string;
@@ -20,7 +20,7 @@ const DocsNavLink: React.FC<{
level: number;
activePath: string;
}> = ({ label, url, level, activePath }) => {
const isCurrent = url == activePath;
const isCurrent = isRouteActive(url, activePath, 0);
const isFirstLevel = level === 0;
return (
@@ -70,7 +70,7 @@ function Tree({
activePath: string;
}) {
return (
<div className={cn('w-full space-y-2.5 pl-3', level > 0 ? 'border-l' : '')}>
<div className={cn('w-full space-y-1 pl-3')}>
{pages.map((treeNode, index) => (
<Node
key={index}
@@ -84,7 +84,7 @@ function Tree({
}
export function DocsNavigation({ pages }: { pages: Cms.ContentItem[] }) {
const activePath = usePathname().replace('/docs/', '');
const activePath = usePathname();
return (
<>
@@ -109,7 +109,7 @@ export function DocsNavigation({ pages }: { pages: Cms.ContentItem[] }) {
function getNavLinkClassName(isCurrent: boolean, isFirstLevel: boolean) {
return cn(
'group flex h-8 items-center justify-between space-x-2 whitespace-nowrap rounded-md px-3 text-sm leading-none transition-colors',
'group flex min-h-8 items-center justify-between space-x-2 whitespace-nowrap rounded-md px-3 text-sm transition-colors',
{
[`bg-muted`]: isCurrent,
[`hover:bg-muted`]: !isCurrent,

View File

@@ -3,7 +3,7 @@ import Link from 'next/link';
import { If } from '@kit/ui/if';
import { cn } from '@kit/ui/utils';
export function DocumentationPageLink({
export function DocsPageLink({
page,
before,
after,