module NfgUi::Components::Traits::Typeface
Access to pre-designed Alert
traits
Constants
- TRAITS
Public Instance Methods
body_trait()
click to toggle source
# File lib/nfg_ui/components/traits/typeface.rb, line 15 def body_trait self.as = body_tag end
caption_trait()
click to toggle source
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.
# File lib/nfg_ui/components/traits/typeface.rb, line 25 def caption_trait self.as = caption_tag options[:caption] = body end
heading_trait()
click to toggle source
# File lib/nfg_ui/components/traits/typeface.rb, line 30 def heading_trait self.as = heading_tag options[:heading] = body end
subheading_trait()
click to toggle source
# File lib/nfg_ui/components/traits/typeface.rb, line 35 def subheading_trait self.as = subheading_tag options[:subheading] = body end
title_trait()
click to toggle source
# File lib/nfg_ui/components/traits/typeface.rb, line 40 def title_trait self.as = title_tag options[:title] = body end
truncate_trait()
click to toggle source
Add the css class 'text-truncate' to a typeface component
# File lib/nfg_ui/components/traits/typeface.rb, line 46 def truncate_trait options[:class] = [options.try(:[], :class), 'text-truncate'].join(' ').squish end