import { cn } from '@evershop/evershop/lib/util/cn';
import { ChevronRight } from 'lucide-react';
import React from 'react';
export interface SettingMenuItemProps {
/** Destination, resolved server-side via the `url(routeId:)` GraphQL field. */
url: string;
title: string;
description: string;
}
/**
* One row in the Settings navigation (`settingPageMenu` area).
*
* Shared by every core settings section — and available to extensions — so the
* menu reads as ONE list instead of a stack of independently-styled cards.
*
* Design notes:
* - The whole row is the link. The previous version wrapped only the title in
* an `` and compensated with a duplicate icon-button in the actions slot
* that navigated to the same URL; that button was both redundant and
* unlabeled (screen readers announced a nameless "button" per row).
* - Title outranks its own description (14px medium over 12px muted). It used
* to be the other way around — an 11px uppercase title above 14px body.
* - Active state is a tint plus `aria-current="page"`, never a side stripe.
*/
export function SettingMenuItem({
url,
title,
description
}: SettingMenuItemProps) {
// Resolved after mount, not during render: `window` is undefined during SSR,
// so computing this inline renders inactive on the server and active on the
// client — a hydration mismatch. Same pattern as `NavigationItem`.
const [isActive, setIsActive] = React.useState(false);
React.useEffect(() => {
setIsActive(
new URL(url, window.location.origin).pathname === window.location.pathname
);
}, [url]);
return (
{title}
{description}
);
}