You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
800 B
JavaScript
23 lines
800 B
JavaScript
import React from "react"
|
|
import { Link } from "@inertiajs/react"
|
|
import { ArrowDownIcon } from "./Icons"
|
|
|
|
export default function NavDropdown({ name, items }) {
|
|
const active = items.find(act => act.route === route().current())
|
|
|
|
return (
|
|
<div className="dropdown">
|
|
<label tabIndex={0} className={`btn btn-ghost rounded-btn gap-2 ${active ? 'btn-active' : ''}`}>
|
|
{name}
|
|
<ArrowDownIcon/>
|
|
</label>
|
|
<ul tabIndex={0} className="menu dropdown-content p-2 shadow bg-base-100 rounded-box w-52 mt-4">
|
|
{items.map((item, index) => (
|
|
<li key={index}>
|
|
<Link href={route(item.route)}>{item.name}</Link>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</div>
|
|
)
|
|
} |