Sha256: a8e337e7785694cecf43ccd1d8584666a78e947f9b3c5964a8eee5fd689c4587

Contents?: true

Size: 613 Bytes

Versions: 3

Compression:

Stored size: 613 Bytes

Contents

# frozen_string_literal: true

require "staticky/phlex/view_helpers"

class Component < Protos::Component
  include ViteHelpers

  class NullViewContext
    def root? = true
    def current_path = "/"
  end

  def helpers
    @_view_context ||= NullViewContext.new # rubocop:disable Naming/MemoizedInstanceVariableName
  end

  def asset_path(...)
    vite_asset_path(...)
  end

  def image_tag(path, alt:, **)
    img(src: asset_path(path), alt:, **)
  end

  def icon(...)
    render Icon.new(...)
  end

  def inline_link(text, url)
    render Protos::Typography::InlineLink.new(href: url) { text }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
staticky-0.2.0 site_template/lib/component.rb
staticky-0.1.1 site_template/lib/component.rb
staticky-0.1.0 site_template/lib/component.rb