Sha256: f412384b506eeee44e028970a45c5068957f3c84194f15a83dfb39bc7a26a54e
Contents?: true
Size: 1.28 KB
Versions: 2
Compression:
Stored size: 1.28 KB
Contents
# frozen_string_literal: true class FoxTail::Pagination::ActionComponent < FoxTail::ClickableComponent renders_one :visual, types: { icon: { as: :icon, renders: lambda { |icon, options = {}| options[:class] = classnames theme.apply(:visual, self), options[:class] FoxTail::IconBaseComponent.new icon, options } }, svg: { as: :svg, renders: lambda { |path, options = {}| options[:class] = classnames theme.apply(:visual, self), options[:class] FoxTail::InlineSvgComponent.new path, options } }, image: { as: :image, renders: lambda { |source, options = {}| options[:class] = classnames theme.apply(:visual, self), options[:class] image_tag source, options } }, } has_option :action has_option :size has_option :show_label, type: :boolean, default: true def left? %i[first previous].include? action end def right? !left? end def call super do concat visual if visual? && left? concat content_tag(:span, content || i18n_content, class: theme.apply(:label, self)) concat visual if visual? && right? end end private def i18n_content I18n.t action, scope: "helpers.pagination", default: action.to_s.humanize end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fox_tail-0.1.1 | app/components/fox_tail/pagination/action_component.rb |
fox_tail-0.1.0 | app/components/fox_tail/pagination/action_component.rb |