Module: ContentBlockTools::OverrideClasses
- Included in:
- BaseComponent
- Defined in:
- lib/content_block_tools/helpers/override_classes.rb
Overview
Helper methods for generating override CSS classes These methods generate CSS class names for spacing and typography utilities from the GOV.UK Design System.
Instance Method Summary collapse
-
#font_classes(size, weight) ⇒ String
Generates combined font size and weight CSS classes.
-
#font_size_class(size) ⇒ String
Generates a font size CSS class.
-
#font_weight_class(weight) ⇒ String
Generates a font weight CSS class.
-
#margin_classes(top, right = nil, bottom = nil, left = nil) ⇒ String
Generates margin CSS classes.
-
#padding_classes(top, right = nil, bottom = nil, left = nil) ⇒ String
Generates padding CSS classes.
Instance Method Details
#font_classes(size, weight) ⇒ String
Generates combined font size and weight CSS classes
58 59 60 61 62 63 |
# File 'lib/content_block_tools/helpers/override_classes.rb', line 58 def font_classes(size, weight) [ font_size_class(size), font_weight_class(weight), ].join(" ") end |
#font_size_class(size) ⇒ String
Generates a font size CSS class
73 74 75 |
# File 'lib/content_block_tools/helpers/override_classes.rb', line 73 def font_size_class(size) "govuk-!-font-size-#{size}" end |
#font_weight_class(weight) ⇒ String
Generates a font weight CSS class
85 86 87 |
# File 'lib/content_block_tools/helpers/override_classes.rb', line 85 def font_weight_class(weight) "govuk-!-font-weight-#{weight}" end |
#margin_classes(top, right = nil, bottom = nil, left = nil) ⇒ String
Generates margin CSS classes
22 23 24 |
# File 'lib/content_block_tools/helpers/override_classes.rb', line 22 def margin_classes(top, right = nil, bottom = nil, left = nil) spacing_classes("margin", top, right, bottom, left) end |
#padding_classes(top, right = nil, bottom = nil, left = nil) ⇒ String
Generates padding CSS classes
41 42 43 |
# File 'lib/content_block_tools/helpers/override_classes.rb', line 41 def padding_classes(top, right = nil, bottom = nil, left = nil) spacing_classes("padding", top, right, bottom, left) end |