Sha256: 52f47693c633c70905d59944277a9f82b66c690dc06f008442140ea234c1266d

Contents?: true

Size: 606 Bytes

Versions: 25

Compression:

Stored size: 606 Bytes

Contents

module Coco
  class PagerButton < 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

25 entries across 25 versions & 1 rubygems

Version Path
coveragebook_components-0.19.8 app/components/coco/navigation/pager_button/pager_button.rb
coveragebook_components-0.19.7 app/components/coco/navigation/pager_button/pager_button.rb
coveragebook_components-0.19.6 app/components/coco/navigation/pager_button/pager_button.rb
coveragebook_components-0.19.5 app/components/coco/navigation/pager_button/pager_button.rb
coveragebook_components-0.19.4 app/components/coco/navigation/pager_button/pager_button.rb
coveragebook_components-0.19.3 app/components/coco/navigation/pager_button/pager_button.rb
coveragebook_components-0.19.2 app/components/coco/navigation/pager_button/pager_button.rb
coveragebook_components-0.19.1 app/components/coco/navigation/pager_button/pager_button.rb
coveragebook_components-0.19.0 app/components/coco/navigation/pager_button/pager_button.rb
coveragebook_components-0.18.8 app/components/coco/navigation/pager_button/pager_button.rb
coveragebook_components-0.18.7 app/components/coco/navigation/pager_button/pager_button.rb
coveragebook_components-0.18.0 app/components/coco/navigation/pager_button/pager_button.rb
coveragebook_components-0.17.7 app/components/coco/navigation/pager_button/pager_button.rb
coveragebook_components-0.17.6 app/components/coco/navigation/pager_button/pager_button.rb
coveragebook_components-0.17.5 app/components/coco/navigation/pager_button/pager_button.rb
coveragebook_components-0.17.4 app/components/coco/navigation/pager_button/pager_button.rb
coveragebook_components-0.17.3 app/components/coco/navigation/pager_button/pager_button.rb
coveragebook_components-0.17.2 app/components/coco/navigation/pager_button/pager_button.rb
coveragebook_components-0.17.1 app/components/coco/navigation/pager_button/pager_button.rb
coveragebook_components-0.17.0 app/components/coco/navigation/pager_button/pager_button.rb