Sha256: 063efedbfcf91e48e62af157c56fdde3e58143f374d402f732f48bc940e647e6
Contents?: true
Size: 1.49 KB
Versions: 60
Compression:
Stored size: 1.49 KB
Contents
# frozen_string_literal: true module NfgUi module Components module Traits # Access to pre-designed Alert traits module Typeface TRAITS = %i[body caption heading subheading title muted truncate].freeze def body_trait self.as = body_tag end # TODO: this was a tricky one and needs specs (as well as other traits need this spec) # Write a spec that tests that the typeface is ACTUALLY a caption # this was identified earlier as not happening because we'd set the as option # but it wasn't spitting out the caption css_class... # after some exploring it turned out the component didn't understand that it # was actually a caption... it just looked like one. def caption_trait self.as = caption_tag options[:caption] = body end def heading_trait self.as = heading_tag options[:heading] = body end def subheading_trait self.as = subheading_tag options[:subheading] = body end def title_trait self.as = title_tag options[:title] = body end # Add the css class 'text-truncate' to a typeface component def truncate_trait options[:class] = [options.try(:[], :class), 'text-truncate'].join(' ').squish end end end end end
Version data entries
60 entries across 60 versions & 1 rubygems