Sha256: 5b6778d1ed6bb6f3bf4761d1c07d2a7972cc85e41769b10e8a86ba6bad41235a

Contents?: true

Size: 1.53 KB

Versions: 5

Compression:

Stored size: 1.53 KB

Contents

# frozen_string_literal: true

module SolidusAdmin::Layout::PageHelpers
  def page(**attrs, &block)
    tag.div(capture(&block), class: "px-4 relative", "data-controller": stimulus_id, **attrs) +
      tag.div(render(component("layout/feedback").new), class: "flex justify-center py-10")
  end

  def page_header_actions(&block)
    tag.div(safe_join([
      capture(&block),
    ]), class: "flex gap-2 items-center")
  end

  def page_header_back(back_path)
    render component("ui/button").new(
      tag: :a,
      title: t(".back"),
      icon: "arrow-left-line",
      scheme: :secondary,
      href: back_path
    )
  end

  def page_header_title(title, &block)
    tag.h1(safe_join([
      tag.span(title, class: "font-semibold text-xl"),
      (capture(&block) if block_given?) || "",
    ]), class: "flex-1 text-2xl font-bold")
  end

  def page_header(&block)
    tag.header(capture(&block), class: "py-6 flex items-center gap-4")
  end

  def page_with_sidebar(&block)
    tag.div(capture(&block), class: "flex gap-4 items-start pb-4")
  end

  def page_with_sidebar_main(&block)
    tag.div(capture(&block), class: "justify-center items-start gap-4 flex flex-col w-full")
  end

  def page_with_sidebar_aside(&block)
    tag.aside(capture(&block), class: "justify-center items-start gap-4 flex flex-col w-full max-w-sm")
  end

  def page_footer(&block)
    tag.div(capture(&block), class: "mt-4 py-4 px-2 pb-8 border-t border-gray-100 flex")
  end

  def page_footer_actions(&block)
    tag.div(capture(&block), class: "flex gap-2 grow")
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
solidus_admin-0.3.2 app/components/solidus_admin/layout/page_helpers.rb
solidus_admin-0.3.1 app/components/solidus_admin/layout/page_helpers.rb
solidus_admin-0.3.0 app/components/solidus_admin/layout/page_helpers.rb
solidus_admin-0.2.0 app/components/solidus_admin/layout/page_helpers.rb
solidus_admin-0.1.0 app/components/solidus_admin/layout/page_helpers.rb