Merge remote-tracking branch 'origin/master' into feature/slicing

This commit is contained in:
fredy.siswanto
2025-02-23 17:03:52 +07:00
18 changed files with 309 additions and 25 deletions
+21
View File
@@ -0,0 +1,21 @@
import type { JSX, SVGProps } from 'react'
export const ChevronDownIcon = (
properties: JSX.IntrinsicAttributes & SVGProps<SVGSVGElement>,
) => {
return (
<svg
width={21}
height={21}
viewBox="0 0 21 21"
fill="none"
xmlns="http://www.w3.org/2000/svg"
{...properties}
>
<path
d="M10.197 13.623l5.008-5.008-1.177-1.18-3.83 3.834-3.831-3.833-1.178 1.178 5.008 5.009z"
fill="currentColor"
/>
</svg>
)
}
+38
View File
@@ -0,0 +1,38 @@
import type { JSX, SVGProps } from 'react'
interface NotificationIconProperties
extends JSX.IntrinsicAttributes,
SVGProps<SVGSVGElement> {
showBadge?: boolean
}
export const NotificationIcon = ({
showBadge = false,
...properties
}: NotificationIconProperties) => {
return (
<svg
width={16}
height={19}
viewBox="0 0 16 19"
fill="none"
xmlns="http://www.w3.org/2000/svg"
{...properties}
>
<path
d="M6.597 18.53a1.616 1.616 0 01-1.608-1.6h3.2c.001.213-.04.425-.12.623-.21.482-.639.833-1.152.944h-.038c-.093.02-.187.03-.282.032zm6.4-2.4H.197v-1.6l1.6-.8v-4.4a6.452 6.452 0 01.739-3.249 3.723 3.723 0 012.46-1.808V2.53h3.2v1.744c2.064.492 3.2 2.287 3.2 5.056v4.4l1.6.8v1.6z"
fill="currentColor"
/>
{showBadge && (
<circle
cx={11.1968}
cy={4.306_64}
r={3.6}
fill="#EC5252"
stroke="#fff"
strokeWidth={1.2}
/>
)}
</svg>
)
}
+1 -1
View File
@@ -22,7 +22,7 @@ const AdminContext = createContext<AdminContextProperties | undefined>(
export const AdminProvider = ({ children }: PropsWithChildren) => {
const [adminProfile, setAdminProfile] = useState<AdminProfile>({
name: '',
name: 'Admin',
})
return (
+2 -2
View File
@@ -6,11 +6,11 @@ import { Sidebar } from './sidebar'
export const AdminDashboardLayout = (properties: PropsWithChildren) => {
const { children } = properties
return (
<div className="grid">
<div className="flex flex-col">
<Navbar />
<div className="flex">
<Sidebar />
<div>{children}</div>
<div className="min-h-[calc(100dvh-80px)] flex-1 p-8">{children}</div>
</div>
</div>
)
+36 -1
View File
@@ -1,3 +1,38 @@
import { Link } from 'react-router'
import { ChevronDownIcon } from '~/components/icons/chevron-down'
import { NotificationIcon } from '~/components/icons/notification'
import { useAdminContext } from '~/contexts/admin'
import { APP } from '~/data/meta'
export const Navbar = () => {
return <div>Navbar</div>
const { adminProfile } = useAdminContext()
return (
<div className="flex h-20 items-center justify-between border-b border-[#ECECEC] bg-white px-10 py-5">
<Link
to="/news"
className="h-full"
>
<img
src={APP.logo}
alt={APP.title}
className="h-3/4 w-auto sm:h-full"
/>
</Link>
<div className="flex items-center gap-x-8">
<div className="flex w-3xs items-center justify-between">
<div className="flex items-center">
<div className="mr-3 h-8 w-8 rounded-full bg-[#C4C4C4]" />
<span className="text-xs">{adminProfile.name}</span>
</div>
<ChevronDownIcon className="opacity-10" />
</div>
<NotificationIcon
className="text-[#B0C3CC]"
showBadge={true}
/>
</div>
</div>
)
}
+28 -14
View File
@@ -1,29 +1,43 @@
import { Link } from 'react-router'
import { NavLink, useLocation } from 'react-router'
import { twMerge } from 'tailwind-merge'
import { MENU } from './menu'
export const Sidebar = () => {
const { pathname } = useLocation()
return (
<div className="flex flex-col gap-y-10 p-5">
<div className="flex min-h-[calc(100dvh-80px)] flex-col gap-y-10 overflow-y-auto bg-white p-5">
{MENU.map(({ group, items }) => (
<div className="flex flex-col">
<div
key={group}
className="px-5 pb-4 text-[#4C5CA0]/50 uppercase"
>
{group}
</div>
<div
className="flex flex-col"
key={group}
>
<div className="px-5 pb-4 text-[#4C5CA0]/50 uppercase">{group}</div>
{items.map(({ title, url, icon: Icon }) => (
<Link
<NavLink
to={url}
key={`${group}-${title}`}
className="group/menu hover:bg-opacity-10 flex h-[42px] w-[200px] items-center gap-x-3 rounded-md px-5 transition-all hover:bg-[#707FDD]/10 hover:font-bold hover:text-[#5363AB]"
className={twMerge(
pathname === url ? 'bg-[#707FDD]/10 font-bold' : '',
'group/menu flex h-[42px] w-[200px] items-center gap-x-3 rounded-md px-5 transition-all hover:bg-[#707FDD]/10',
)}
>
<Icon className="h-[18px] w-[18px] text-[#A6ABC8] transition-all group-hover/menu:text-[#5363AB]" />
<span className="text-[#273240] transition-all group-hover/menu:text-[#5363AB]">
<Icon
className={twMerge(
pathname === url ? 'text-[#5363AB]' : 'text-[#A6ABC8]',
'h-[18px] w-[18px] transition-all group-hover/menu:text-[#5363AB]',
)}
/>
<span
className={twMerge(
pathname === url ? 'text-[#5363AB]' : 'text-[#273240]',
'text-base transition-all group-hover/menu:text-[#5363AB]',
)}
>
{title}
</span>
</Link>
</NavLink>
))}
</div>
))}
@@ -1,10 +1,4 @@
const DashboardIndexLayout = () => {
return (
<div className="relative">
<div className="flex min-h-screen items-center justify-center bg-gray-100">
Dashboard Page
</div>
</div>
)
return <div>Dashboard Page</div>
}
export default DashboardIndexLayout
@@ -0,0 +1,4 @@
const DashboardAdminsLayout = () => {
return <div>Admins Page</div>
}
export default DashboardAdminsLayout
@@ -0,0 +1,4 @@
const DashboardAdvertisementsLayout = () => {
return <div>Advertisements Page</div>
}
export default DashboardAdvertisementsLayout
@@ -0,0 +1,4 @@
const DashboardContentsLayout = () => {
return <div>Contents Page</div>
}
export default DashboardContentsLayout
@@ -0,0 +1,4 @@
const DashboardSettingsLayout = () => {
return <div>Settings Page</div>
}
export default DashboardSettingsLayout
@@ -0,0 +1,4 @@
const DashboardSiteDataLayout = () => {
return <div>Site Data Page</div>
}
export default DashboardSiteDataLayout
@@ -0,0 +1,4 @@
const DashboardSubscriptionsLayout = () => {
return <div>Subscriptions Page</div>
}
export default DashboardSubscriptionsLayout
@@ -0,0 +1,4 @@
const DashboardUsersLayout = () => {
return <div>Users Page</div>
}
export default DashboardUsersLayout