Sha256: e3b11d04159df4524028cc86c194518494d6f0cb521df2a6749f2cae0b44624d
Contents?: true
Size: 951 Bytes
Versions: 4
Compression:
Stored size: 951 Bytes
Contents
module Coco class Link < Coco::Component include Concerns::ActsAsLink include Concerns::WithIcon include Concerns::AcceptsOptions include Concerns::AcceptsTheme THEMES = %W[positive primary warning negative info neutral-dark neutral-light] << nil accepts_option :theme, from: THEMES accepts_option :underline, from: [true, false] before_initialize do |kwargs| if kwargs.key?(:modal) modal_name = (kwargs[:modal] == true) ? "default" : kwargs[:modal] kwargs[:data] = kwargs.fetch(:data, {}).merge(coco_modal_data_attributes(modal_name)) kwargs.delete(:modal) end kwargs end def call render component_tag(class: ["coco-link", ("with-icon" if icon?)]) do safe_join([ icon, icon? ? tag.span(link_text, class: "link-text") : link_text ]) end end class << self include Coco::SharedHelper end end end
Version data entries
4 entries across 4 versions & 1 rubygems