feat(SW-186): Added refs and some extra querys
This commit is contained in:
@@ -13,16 +13,12 @@ import type { NavigationMenuItemProps } from "@/types/components/header/navigati
|
||||
|
||||
export default function MenuItem({ item, isMobile }: NavigationMenuItemProps) {
|
||||
const { submenu, title, link, seeAllLink, card } = item
|
||||
const [isExpanded, setIsExpanded] = useState(false)
|
||||
const [isExpanded, setIsExpanded] = useState(false) // TODO: Use store to manage this state when adding the menu itself.
|
||||
|
||||
function handleButtonClick() {
|
||||
setIsExpanded((prev) => !prev)
|
||||
}
|
||||
|
||||
if (!submenu.length && !link) {
|
||||
return null
|
||||
}
|
||||
|
||||
return submenu.length ? (
|
||||
<MainMenuButton
|
||||
onClick={handleButtonClick}
|
||||
|
||||
@@ -46,7 +46,7 @@ export default async function MainMenu({
|
||||
/>
|
||||
</NextLink>
|
||||
<div className={styles.menus}>
|
||||
{menuItems ? (
|
||||
{menuItems?.length ? (
|
||||
<NavigationMenu items={menuItems} isMobile={false} />
|
||||
) : null}
|
||||
{user ? (
|
||||
@@ -74,7 +74,7 @@ export default async function MainMenu({
|
||||
</span>
|
||||
</Link>
|
||||
)}
|
||||
{menuItems ? (
|
||||
{menuItems?.length ? (
|
||||
<MobileMenu languageUrls={languageUrls} menuItems={menuItems} />
|
||||
) : null}
|
||||
</div>
|
||||
@@ -82,26 +82,3 @@ export default async function MainMenu({
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const error = {
|
||||
query: { lang: "sv" },
|
||||
error: {
|
||||
issues: [
|
||||
{
|
||||
code: "invalid_type",
|
||||
expected: "string",
|
||||
received: "null",
|
||||
path: ["all_header", "items", 0, "top_link", "title"],
|
||||
message: "Expected string, received null",
|
||||
},
|
||||
{
|
||||
code: "invalid_type",
|
||||
expected: "array",
|
||||
received: "null",
|
||||
path: ["all_header", "items", 0, "menu_items"],
|
||||
message: "Expected array, received null",
|
||||
},
|
||||
],
|
||||
name: "ZodError",
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user