's'
This commit is contained in:
@@ -85,6 +85,7 @@ export default memo(function SiteMenu({
|
||||
{
|
||||
titleKey: "other",
|
||||
items: [
|
||||
{ labelKey: "digitalNomadGuide", href: "https://digital.hackrobot.cn/", icon: "📖" },
|
||||
{ labelKey: "remoteJobs", href: "#", icon: "💼" },
|
||||
{ labelKey: "coworking", href: "#", icon: "🏢" },
|
||||
],
|
||||
@@ -134,17 +135,42 @@ export default memo(function SiteMenu({
|
||||
{t(section.titleKey)}
|
||||
</h3>
|
||||
<ul className="space-y-1">
|
||||
{section.items.map((item) => (
|
||||
{section.items.map((item) => {
|
||||
const isExternal = item.href.startsWith("http");
|
||||
const linkClass = `flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors ${
|
||||
item.href !== "#" && !isExternal && (pathname === item.href || (item.href !== "/" && pathname.startsWith(item.href)))
|
||||
? "bg-[#ff4d4f]/10 text-[#ff4d4f]"
|
||||
: "text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800"
|
||||
}`;
|
||||
return (
|
||||
<li key={item.labelKey}>
|
||||
<Link
|
||||
href={item.href}
|
||||
onClick={onClose}
|
||||
className={`flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors ${
|
||||
item.href !== "#" && (pathname === item.href || (item.href !== "/" && pathname.startsWith(item.href)))
|
||||
? "bg-[#ff4d4f]/10 text-[#ff4d4f]"
|
||||
: "text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800"
|
||||
}`}
|
||||
>
|
||||
{isExternal ? (
|
||||
<a
|
||||
href={item.href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
onClick={onClose}
|
||||
className={linkClass}
|
||||
>
|
||||
<span className="w-5 text-center">{item.icon}</span>
|
||||
<span className="flex-1">{t(item.labelKey)}</span>
|
||||
{item.new && (
|
||||
<span className="px-2 py-0.5 rounded-full bg-[#ff4d4f] text-white text-[10px] font-medium">
|
||||
NEW
|
||||
</span>
|
||||
)}
|
||||
{item.ad && (
|
||||
<span className="px-2 py-0.5 rounded bg-gray-200 dark:bg-gray-700 text-[10px] text-gray-500">
|
||||
Ad
|
||||
</span>
|
||||
)}
|
||||
</a>
|
||||
) : (
|
||||
<Link
|
||||
href={item.href}
|
||||
onClick={onClose}
|
||||
className={linkClass}
|
||||
>
|
||||
<span className="w-5 text-center">{item.icon}</span>
|
||||
<span className="flex-1">{t(item.labelKey)}</span>
|
||||
{item.new && (
|
||||
@@ -158,8 +184,10 @@ export default memo(function SiteMenu({
|
||||
</span>
|
||||
)}
|
||||
</Link>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user