Sha256: f58b19597c858620008af5280a5763dd4c61e60dcb49248fa207488c63546be7

Contents?: true

Size: 580 Bytes

Versions: 29

Compression:

Stored size: 580 Bytes

Contents

module Coco
  class Spacer < Coco::Component
    include Concerns::AcceptsOptions

    SIZES = [0, 1, 2, 3, 4, 5, 6, 7, 8]

    BREAKPOINTS = %i[sm md lg xl]

    DEFAULT = 4

    accepts_option :size, from: SIZES, default: DEFAULT
    accepts_option :scale_from, from: BREAKPOINTS, private: true
    accepts_option :responsive, from: [true, false], default: true, private: true

    def call
      render component_tag(:div, data: {scale_from:})
    end

    def scale_from
      get_option_value(:responsive) ? get_option_value(:scale_from) : BREAKPOINTS.last
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
coveragebook_components-0.19.8 app/components/coco/layout/spacer/spacer.rb
coveragebook_components-0.19.7 app/components/coco/layout/spacer/spacer.rb
coveragebook_components-0.19.6 app/components/coco/layout/spacer/spacer.rb
coveragebook_components-0.19.5 app/components/coco/layout/spacer/spacer.rb
coveragebook_components-0.19.4 app/components/coco/layout/spacer/spacer.rb
coveragebook_components-0.19.3 app/components/coco/layout/spacer/spacer.rb
coveragebook_components-0.19.2 app/components/coco/layout/spacer/spacer.rb
coveragebook_components-0.19.1 app/components/coco/layout/spacer/spacer.rb
coveragebook_components-0.19.0 app/components/coco/layout/spacer/spacer.rb
coveragebook_components-0.18.8 app/components/coco/layout/spacer/spacer.rb
coveragebook_components-0.18.7 app/components/coco/layout/spacer/spacer.rb
coveragebook_components-0.18.0 app/components/coco/layout/spacer/spacer.rb
coveragebook_components-0.17.7 app/components/coco/layout/spacer/spacer.rb
coveragebook_components-0.17.6 app/components/coco/layout/spacer/spacer.rb
coveragebook_components-0.17.5 app/components/coco/layout/spacer/spacer.rb
coveragebook_components-0.17.4 app/components/coco/layout/spacer/spacer.rb
coveragebook_components-0.17.3 app/components/coco/layout/spacer/spacer.rb
coveragebook_components-0.17.2 app/components/coco/layout/spacer/spacer.rb
coveragebook_components-0.17.1 app/components/coco/layout/spacer/spacer.rb
coveragebook_components-0.17.0 app/components/coco/layout/spacer/spacer.rb