Header nav bar
This commit is contained in:
25
src/Header/Nav/index.tsx
Normal file
25
src/Header/Nav/index.tsx
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
import type { Header as HeaderType } from '@/src/payload-types'
|
||||||
|
|
||||||
|
import { CMSLink } from '@/src/components/Link'
|
||||||
|
import Link from 'next/link'
|
||||||
|
import { SearchIcon } from 'lucide-react'
|
||||||
|
|
||||||
|
export const HeaderNav: React.FC<{ data: HeaderType }> = ({ data }) => {
|
||||||
|
const navItems = data?.navItems || []
|
||||||
|
|
||||||
|
return (
|
||||||
|
<nav className="flex gap-3 items-center">
|
||||||
|
{navItems.map(({ link }, i) => {
|
||||||
|
return <CMSLink key={i} {...link} appearance="link" />
|
||||||
|
})}
|
||||||
|
<Link href="/search">
|
||||||
|
<span className="sr-only">Search</span>
|
||||||
|
<SearchIcon className="w-5 text-primary" />
|
||||||
|
</Link>
|
||||||
|
</nav>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import './globals.css'
|
import './globals.css'
|
||||||
import { AdminBar } from '@/src/components/AdminBar'
|
import { AdminBar } from '@/src/components/AdminBar'
|
||||||
|
import { GLOBALS_QUERY } from '@/utilities/queries'
|
||||||
|
import { Header } from '@/src/Header/Component'
|
||||||
|
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
description: 'Web developer',
|
description: 'Web developer',
|
||||||
@@ -9,11 +11,14 @@ export const metadata = {
|
|||||||
|
|
||||||
export default async function RootLayout(props: { children: React.ReactNode }) {
|
export default async function RootLayout(props: { children: React.ReactNode }) {
|
||||||
const { children } = props
|
const { children } = props
|
||||||
|
const data = GLOBALS_QUERY
|
||||||
|
console.log(data)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<body>
|
<body>
|
||||||
<AdminBar />
|
<AdminBar />
|
||||||
|
<Header />
|
||||||
<main>{children}</main>
|
<main>{children}</main>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
7
src/components/Navbar.tsx
Normal file
7
src/components/Navbar.tsx
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
export default function Navbar() {
|
||||||
|
return (
|
||||||
|
<nav>Navbar</nav>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -3,6 +3,10 @@ import { getPayload } from "payload"
|
|||||||
|
|
||||||
const payload = await getPayload({ config: payloadConfig })
|
const payload = await getPayload({ config: payloadConfig })
|
||||||
|
|
||||||
|
export const GLOBALS_QUERY = await payload.findGlobal({
|
||||||
|
slug: 'header',
|
||||||
|
})
|
||||||
|
|
||||||
export const HOMEPAGE_QUERY = await payload.find({
|
export const HOMEPAGE_QUERY = await payload.find({
|
||||||
collection: 'pages',
|
collection: 'pages',
|
||||||
where: {
|
where: {
|
||||||
|
|||||||
Reference in New Issue
Block a user