(defcomp
  (&key path &rest children)
  :affinity :server
  (let*
    ((nav-state (resolve-nav-path sx-nav-tree (or path "/")))
      (trail (or (get nav-state "trail") (list)))
      (trail-len (len trail))
      (depth (+ trail-len 1)))
    (<>
      (div
        :id "sx-nav"
        (~tw :tokens "mb-6")
        :sx-swap-oob "innerHTML"
        (div
          :id "logo-opacity"
          :style (str
            "opacity:"
            (+ (* (/ 1 depth) 0.75) 0.25)
            ";"
            "transition:opacity 0.3s;")
          (~layouts/header :path (or path "/")))
        (map-indexed
          (fn
            (i crumb)
            (~layouts/nav-sibling-row
              :node (get crumb "node")
              :siblings (get crumb "siblings")
              :is-leaf (= i (- trail-len 1))
              :level (+ i 2)
              :depth depth))
          trail)
        (when
          (get nav-state "children")
          (~layouts/nav-children :items (get nav-state "children"))))
      (div :id "sx-content" (error-boundary children) (~tw/flush)))))
