(defisland
  ()
  (let
    ((data (resource (fn () (promise-delayed 1500 (dict "name" "Ada Lovelace" "role" "First Programmer" "year" 1843))))))
    (div
      (~tw :tokens "rounded border border-violet-200 bg-violet-50 p-4 my-4")
      (cond
        (get (deref data) "loading")
        (div
          (~tw :tokens "flex items-center gap-2 text-stone-500")
          (span
            (~tw :tokens "inline-block w-4 h-4 border-2 border-stone-300 border-t-violet-600 rounded-full animate-spin"))
          (span (~tw :tokens "text-sm") "Loading..."))
        (get (deref data) "error")
        (div
          (~tw :tokens "p-3 bg-red-50 border border-red-200 rounded")
          (p
            (~tw :tokens "text-red-700 text-sm")
            "Error: "
            (get (deref data) "error")))
        :else (let
          ((d (get (deref data) "data")))
          (div
            (~tw :tokens "space-y-1")
            (p (~tw :tokens "font-bold text-stone-800") (get d "name"))
            (p
              (~tw :tokens "text-sm text-stone-600")
              (get d "role")
              " ("
              (get d "year")
              ")")))))))
