import { useRouter } from 'expo-router'
import type { NavIntent } from '../intents'
import { MenuIconButton } from '../MenuBar'

// renderNav — a navigation-to-route intent. Small convenience so consumers
// don't have to wrap `router.push(href)` in an onPress every time.

export function RenderNav({
  intent,
  reduceMotion,
  size,
  tint,
}: {
  intent: NavIntent
  reduceMotion?: boolean
  size?: number
  tint?: string
}) {
  const router = useRouter()
  return (
    <MenuIconButton
      icon={intent.icon}
      onPress={() => router.push(intent.to)}
      accessibilityLabel={intent.accessibilityLabel ?? intent.label}
      accessibilityHint={intent.accessibilityHint}
      reduceMotion={reduceMotion}
      size={size}
      tint={tint}
    />
  )
}
