{{ define "repo/fragments/fileTree" }}
  {{ if and .Name .IsDirectory }}
    <details open>
      <summary class="cursor-pointer list-none pt-1">
        <span class="tree-directory inline-flex items-center gap-2 ">
          {{ i "folder" "flex-shrink-0 size-4 fill-current" }}
          <span class="filename truncate text-black dark:text-white">{{ .Name }}</span>
        </span>
      </summary>
      <div class="ml-1 pl-2 border-l border-gray-200 dark:border-gray-700">
        {{ range $child := .Children }}
          {{ template "repo/fragments/fileTree" $child }}
        {{ end }}
      </div>
    </details>
  {{ else if .Name }}
    <div class="tree-file flex items-center gap-2 pt-1">
      {{ i "file" "flex-shrink-0 size-4" }}
      <a href="#file-{{ .Path }}" data-path="{{ .Path }}" class="filetree-link filename truncate text-black dark:text-white no-underline hover:underline">{{ .Name }}</a>
    </div>
  {{ else }}
    {{ range $child := .Children }}
      {{ template "repo/fragments/fileTree" $child }}
    {{ end }}
  {{ end }}
{{ end }}

