Class: PhlexKit::PaginationPrevious

Inherits:
BaseComponent show all
Defined in:
app/components/phlex_kit/pagination/pagination_previous.rb

Overview

"Previous" control (chevron + label, label hidden on small screens), ported from shadcn/ui's PaginationPrevious. Renders its own

  • . See pagination.rb.

  • Instance Method Summary collapse

    Methods inherited from BaseComponent

    #on

    Constructor Details

    #initialize(href: "#", label: "Previous", **attrs) ⇒ PaginationPrevious

    Returns a new instance of PaginationPrevious.

    
    
    6
    7
    8
    9
    10
    # File 'app/components/phlex_kit/pagination/pagination_previous.rb', line 6
    
    def initialize(href: "#", label: "Previous", **attrs)
      @href = href
      @label = label
      @attrs = attrs
    end

    Instance Method Details

    #view_templateObject

    
    
    12
    13
    14
    15
    16
    17
    18
    19
    # File 'app/components/phlex_kit/pagination/pagination_previous.rb', line 12
    
    def view_template
      li do
        a(**mix({ href: @href, class: "pk-button ghost pk-pagination-previous", aria: { label: "Go to previous page" } }, @attrs)) do
          render Icon.new(:chevron_left, size: nil)
          span(class: "pk-pagination-label") { @label }
        end
      end
    end