feat: add header menu and search components with menu data for news page

This commit is contained in:
Ardeman 2025-02-01 01:19:01 +08:00
parent d2534bd94e
commit 89da497cc9
4 changed files with 66 additions and 0 deletions

30
app/data/menu.ts Normal file
View File

@ -0,0 +1,30 @@
export const MENU = [
{
title: 'Spotlight',
url: '/topic?category=spotlight',
},
{
title: 'Berita',
url: '/topic?category=berita',
},
{
title: 'Kasus',
url: '/topic?category=kasus',
},
{
title: 'Kajian',
url: '/topic?category=kajian',
},
{
title: 'Lifestyle',
url: '/topic?category=lifestyle',
},
{
title: 'Event',
url: '/topic?category=event',
},
{
title: 'Travel',
url: '/topic?category=travel',
},
]

View File

@ -0,0 +1,24 @@
import { Link } from 'react-router'
import { MENU } from '~/data/menu'
import { HeaderSearch } from './header-search'
export const HeaderMenu = () => {
return (
<div className="flex h-[60px] items-center justify-between bg-[#2E2F7C] text-xl font-medium text-white">
{MENU.map((item) => (
<Link
key={item.title}
to={item.url}
className={
'flex h-full items-center justify-center border-r border-white px-[35px]'
}
>
{item.title}
</Link>
))}
<HeaderSearch />
</div>
)
}

View File

@ -0,0 +1,10 @@
export const HeaderSearch = () => {
return (
<form className="flex-1 px-[35px]">
<input
placeholder="Cari..."
className="placeholder:text-white focus:ring-0 focus:outline-none"
/>
</form>
)
}

View File

@ -1,5 +1,6 @@
import React, { type FC, type PropsWithChildren } from 'react'
import { HeaderMenu } from './header-menu'
import { HeaderTop } from './header-top'
export const NewsPage: FC<PropsWithChildren> = ({ children }) => {
@ -7,6 +8,7 @@ export const NewsPage: FC<PropsWithChildren> = ({ children }) => {
<main className="min-h-dvh bg-[#ECECEC]">
<header>
<HeaderTop />
<HeaderMenu />
</header>
{children}
</main>