Sha256: b34a86a954c01b58a1e5d6a4ab063604294ee2222466755c6612bba4856d760d
Contents?: true
Size: 1.53 KB
Versions: 3
Compression:
Stored size: 1.53 KB
Contents
require 'glimmer/opal/property_owner' module Glimmer module Opal class GridLayoutProxy include PropertyOwner attr_reader :parent, :args, :num_columns, :make_columns_equal_width, :horizontal_spacing, :vertical_spacing def initialize(parent, args) @parent = parent @args = args @parent.add_css_class('grid-layout') @horizontal_spacing = 10 @vertical_spacing = 10 @num_columns = @args.first || 1 reapply end def num_columns=(columns) @num_columns = columns # @parent.add_css_class("num-columns-#{@num_columns}") reapply end def make_columns_equal_width=(equal_width) @make_columns_equal_width = equal_width # @parent.add_css_class('make_columns_equal_width') if @make_columns_equal_width reapply end def horizontal_spacing=(spacing) @horizontal_spacing = spacing # @parent.add_css_class("horizontal-spacing-#{@horizontal_spacing}") reapply end def vertical_spacing=(spacing) @vertical_spacing = spacing # @parent.add_css_class("vertical-spacing-#{@vertical_spacing}") reapply end def reapply @parent.css = <<~CSS display: grid; grid-template-columns: #{'auto ' * @num_columns.to_i}; grid-row-gap: #{@vertical_spacing}px; grid-column-gap: #{@horizontal_spacing}px; justify-content: start; CSS end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
glimmer-dsl-opal-0.0.9 | lib/glimmer/opal/grid_layout_proxy.rb |
glimmer-dsl-opal-0.0.8 | lib/glimmer/opal/grid_layout_proxy.rb |
glimmer-dsl-opal-0.0.7 | lib/glimmer/opal/grid_layout_proxy.rb |