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