Class: CubitComponents::BleedComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
lib/cubit_components/bleed_component.rb

Constant Summary collapse

VALID_VATTRS =

Allow negative margin utility classes. They follow Tailwind’s pattern, e.g., “-m-3” or “sm:-mx-4”

Set.new(
  begin
    breakpoints = ["", "sm:", "md:", "lg:", "xl:"]
    directions = ["", "x", "y", "t", "r", "b", "l"]
    values = %w[1 2 3 4 5]
    breakpoints.flat_map do |bp|
      directions.flat_map do |dir|
        values.map do |val|
          # For no breakpoint, produces e.g. "-m-3"
          # For a breakpoint, produces e.g. "sm:-mx-4"
          "#{bp}-m#{dir}-#{val}"
        end
      end
    end
  end
).freeze

Instance Method Summary collapse

Methods inherited from BaseComponent

#call

Constructor Details

#initialize(element: "div", classes: "", vattrs: []) ⇒ BleedComponent

Returns a new instance of BleedComponent.



22
23
24
# File 'lib/cubit_components/bleed_component.rb', line 22

def initialize(element: "div", classes: "", vattrs: [])
  super
end