lib/cosensee/tailwind_renderer/icon_bracket.rb in cosensee-0.6.0 vs lib/cosensee/tailwind_renderer/icon_bracket.rb in cosensee-0.8.0

- old
+ new

@@ -1,14 +1,15 @@ # frozen_string_literal: true module Cosensee class TailwindRenderer - IconBracket = Data.define(:content) do + IconBracket = Data.define(:content, :project) do include HtmlEncodable def render - # XXX use icon image finder with project object - %(<span>[icon:#{escape_html(content.icon_name)}]</span>) + page = project.find_page_by_title(content.icon_name) + icon_src = page&.first_image&.src + %(<img src="#{icon_src}" loading="lazy" alt="icon" class="inline-block h-5 w-5 align-middle">) end end end end