Sha256: d4e2f932d4e5f9b018738d1f64490be7c7d0c03d0061b3ec5563d0b341e38b71
Contents?: true
Size: 975 Bytes
Versions: 3
Compression:
Stored size: 975 Bytes
Contents
# frozen_string_literal: true module Panda module CMS module Admin class TableComponent < ViewComponent::Base attr_reader :columns def initialize(term:, rows:) @term = term @rows = rows @columns = [] end def column(label, &) @columns << Column.new(label, &) end private # Ensures @columns gets populated [https://dev.to/rolandstuder/supercharged-table-component-built-with-viewcomponent-3j6i] def before_render content end end class Column attr_reader :label, :cell def initialize(label, &block) @label = label @cell = block end end class TagColumn < Column attr_reader :label, :cell def initialize(label, &block) @label = label @cell = Panda::CMS::Admin::TagComponent.new(status: block) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems