2025-02-27 19:37:31 +08:00
|
|
|
import { Link, useRouteLoaderData } from 'react-router'
|
2025-01-31 19:34:22 +08:00
|
|
|
|
2025-02-01 04:59:28 +08:00
|
|
|
import { Button } from '~/components/ui/button'
|
2025-02-25 06:07:45 +08:00
|
|
|
import { APP } from '~/configs/meta'
|
2025-02-22 17:34:25 +08:00
|
|
|
import { useNewsContext } from '~/contexts/news'
|
2025-02-27 19:37:31 +08:00
|
|
|
import type { loader } from '~/routes/_layout.news'
|
2025-01-31 19:34:22 +08:00
|
|
|
|
|
|
|
|
export const HeaderTop = () => {
|
2025-02-22 17:34:25 +08:00
|
|
|
const { setIsLoginOpen } = useNewsContext()
|
2025-02-27 19:37:31 +08:00
|
|
|
const loaderData = useRouteLoaderData<typeof loader>('routes/_layout.news')
|
|
|
|
|
|
2025-01-31 19:34:22 +08:00
|
|
|
return (
|
2025-02-21 20:47:15 +07:00
|
|
|
<>
|
|
|
|
|
<div className="flex h-[60px] items-center justify-between bg-white px-5 align-middle sm:h-[100px] sm:gap-[15px] sm:px-[50px] sm:py-[20px]">
|
|
|
|
|
<Link
|
|
|
|
|
to="/news"
|
|
|
|
|
className="mt-2 h-full py-2"
|
2025-02-20 01:37:35 +07:00
|
|
|
>
|
2025-02-01 00:43:21 +08:00
|
|
|
<img
|
2025-02-21 20:47:15 +07:00
|
|
|
src={APP.logo}
|
|
|
|
|
alt={APP.title}
|
|
|
|
|
className="h-3/4 w-auto sm:h-full"
|
2025-02-01 00:43:21 +08:00
|
|
|
/>
|
2025-02-21 20:47:15 +07:00
|
|
|
</Link>
|
|
|
|
|
<div className="hidden h-full items-center py-1.5 font-light whitespace-pre-line sm:flex">
|
|
|
|
|
{APP.description}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="flex items-center gap-[15px]">
|
|
|
|
|
<Button className="h-8 w-auto rounded-none px-3 text-xs sm:h-[50px] sm:w-[150px] sm:text-lg">
|
|
|
|
|
About Us
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
variant="newsSecondary"
|
|
|
|
|
className="hidden sm:block"
|
2025-02-22 17:14:33 +08:00
|
|
|
onClick={() => setIsLoginOpen(true)}
|
2025-02-21 20:47:15 +07:00
|
|
|
>
|
2025-02-27 19:37:31 +08:00
|
|
|
{loaderData?.userToken ? 'Logout' : 'Masuk'}
|
2025-02-21 20:47:15 +07:00
|
|
|
</Button>
|
2025-02-01 00:43:21 +08:00
|
|
|
</div>
|
2025-01-31 19:34:22 +08:00
|
|
|
</div>
|
2025-02-21 20:47:15 +07:00
|
|
|
</>
|
2025-01-31 19:34:22 +08:00
|
|
|
)
|
|
|
|
|
}
|