Within our NavItem and imageData, we have set up the prop for both the Nav Logo and Nav Listing but we still getting no logo or no Nav list to show up.
Builder.registerComponent(Nav, {
name: "Navigation",
inputs: [
{
name: "UploadLogo",
type: "file",
image:
"https://cdn.builder.io/api/v1/image/assets%2F472c17b44b99422098f586c3fbe4dc2b%2F32e07efa314c4b2382aabc318c1c84b8",
defaultValue: "https://cdn.builder.io/api/v1/image/assets%2F472c17b44b99422098f586c3fbe4dc2b%2F32e07efa314c4b2382aabc318c1c84b8",
},
{
name: "NavColumns",
type: "list",
label: "Columns",
subFields: [
{
name: "NavItem",
type: "text",
},
{
name: "NavUrl",
type: "url",
},
],
},
{
name: "NavIcons",
type: "list",
label: "Columns",
subFields: [
{
name: "Icon",
type: "file",
},
{
name: "PageTitle",
type: "text",
},
{
name: "IconUrl",
type: "url",
},
],
},
],
});
But for the Nav Icons, we were successful in getting those Icons to show up on the page but I want someone to review my code and give feedback.
See if my eyes are missing something that I do not see in my code.
import * as React from "react";
//import Cart from "../eCommerces/Notifications/Cart/cart";
import "../Navbar/navbar-style.css";
function Image({ src, alt }) {
// eslint-disable-next-line @next/next/no-img-element
return <img
src={src}
alt={alt}
/>;
}
const Nav = ({ navItems, imageData, NavIcons }) => {
return (
<div className="container">
<div className="wrapper">
<div className="main-navbar">
{imageData && imageData.length > 0 ? (
<div className="Nav-Logo">
{imageData (
<a href="/">
<Image
src={UploadLogo}
alt="Main Logo"
/>
</a>
)}
</div>
) : (
<p>No Nav Logo Available</p>
)}
{navItems && navItems.length > 0 ? (
<div className="navbar-middle">
{navItems.map((navlist, index) => (
<a key={index} href={navlist.NavUrl}>
{navlist.NavItem}
</a>
))}
</div>
) : (
<p>No Nav Listing Available</p>
)}
<div className="navbar-last">
{NavIcons && NavIcons.length > 0 ? (
<ul>
{NavIcons.map((icon, index) => (
<li key={index}>
<a href={icon.IconUrl}>
<img src={icon.Icon} alt="Icon" />
</a>
</li>
))}
</ul>
) : (
<p>No Icons Available</p>
)}
</div>
{/* This is help page */}
</div>
</div>
</div>
);
}
export default Nav;