Sha256: 870d5f35df73f82c2e869ad79f09ec787dcd9aef126a18ab9dbb6adf93a8f6ec

Contents?: true

Size: 604 Bytes

Versions: 14

Compression:

Stored size: 604 Bytes

Contents

module Coco
  class PagerLink < Coco::Component
    include Concerns::AcceptsOptions

    tag_name :a
    tag_attr :href, :target

    accepts_option :direction, from: %i[previous next], required: true

    renders_one :icon, ->(name, **kwargs) do
      Coco::Icon.new(**kwargs, name: name, size: :xxl)
    end

    before_render do
      unless icon?
        with_icon(next? ? :chevron_right : :chevron_left)
      end
    end

    def direction
      get_option_value(:direction)
    end

    def next?
      direction == :next
    end

    def previous?
      direction == :previous
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
coveragebook_components-0.12.2 app/components/coco/shared/pager_link/pager_link.rb
coveragebook_components-0.12.1 app/components/coco/shared/pager_link/pager_link.rb
coveragebook_components-0.12.0 app/components/coco/shared/pager_link/pager_link.rb
coveragebook_components-0.11.0 app/components/coco/shared/pager_link/pager_link.rb
coveragebook_components-0.10.1.beta.2 app/components/coco/shared/pager_link/pager_link.rb
coveragebook_components-0.10.1.beta.1 app/components/coco/shared/pager_link/pager_link.rb
coveragebook_components-0.10.1.beta.0 app/components/coco/shared/pager_link/pager_link.rb
coveragebook_components-0.10.0 app/components/coco/base/pager_link/pager_link.rb
coveragebook_components-0.9.1 app/components/coco/base/pager_link/pager_link.rb
coveragebook_components-0.9.0 app/components/coco/base/pager_link/pager_link.rb
coveragebook_components-0.8.9 app/components/coco/base/pager_link/pager_link.rb
coveragebook_components-0.8.8 app/components/coco/base/pager_link/pager_link.rb
coveragebook_components-0.8.7 app/components/coco/base/pager_link/pager_link.rb
coveragebook_components-0.8.6 app/components/coco/base/pager_link/pager_link.rb