mirror of
https://github.com/D4M13N-D3V/comissions-app-ui.git
synced 2025-03-14 00:05:07 +00:00
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
// ** Types Import
|
|
import { Settings } from '../core/context/settingsContext'
|
|
import { NavLink, NavSectionTitle, VerticalNavItemsType } from '../core/layouts/types'
|
|
|
|
// ** Custom Menu Components
|
|
import VerticalNavLink from './VerticalNavLink'
|
|
import VerticalNavSectionTitle from './VerticalNavSectionTitle'
|
|
|
|
interface Props {
|
|
settings: Settings
|
|
navVisible?: boolean
|
|
groupActive: string[]
|
|
currentActiveGroup: string[]
|
|
verticalNavItems?: VerticalNavItemsType
|
|
saveSettings: (values: Settings) => void
|
|
setGroupActive: (value: string[]) => void
|
|
setCurrentActiveGroup: (item: string[]) => void
|
|
}
|
|
|
|
const resolveNavItemComponent = (item: NavLink | NavSectionTitle) => {
|
|
if ((item as NavSectionTitle).sectionTitle) return VerticalNavSectionTitle
|
|
|
|
return VerticalNavLink
|
|
}
|
|
|
|
const VerticalNavItems = (props: Props) => {
|
|
// ** Props
|
|
const { verticalNavItems } = props
|
|
|
|
const RenderMenuItems = verticalNavItems?.map((item: NavLink | NavSectionTitle, index: number) => {
|
|
const TagName: any = resolveNavItemComponent(item)
|
|
|
|
return <TagName {...props} key={index} item={item} />
|
|
})
|
|
|
|
return <>{RenderMenuItems}</>
|
|
}
|
|
|
|
export default VerticalNavItems
|