Sha256: 4a6cb9c857bc244785b4c84d965aca8156a1c493b9eac66a73bea2630afe3554
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
module Avo module Concerns module StylesCards extend ActiveSupport::Concern included do class_attribute :cols, default: 1 class_attribute :rows, default: 1 def card_classes result = "" # Writing down the classes so TailwindCSS knows not to purge them classes_for_cols = { 1 => " sm:col-span-1", 2 => " sm:col-span-2", 3 => " sm:col-span-3", 4 => " sm:col-span-4", 5 => " sm:col-span-5", 6 => " sm:col-span-6" } classes_for_rows = { 1 => " sm:row-span-1 min-h-[8rem]", 2 => " sm:row-span-2 min-h-[16rem]", 3 => " sm:row-span-3 min-h-[24rem]", 4 => " sm:row-span-4 min-h-[32rem]", 5 => " sm:row-span-5 min-h-[40rem]", 6 => " sm:row-span-6 min-h-[48rem]", } result += classes_for_cols[cols.to_i] if classes_for_cols[cols.to_i].present? result += classes_for_rows[rows.to_i] if classes_for_rows[rows.to_i].present? result end def cols @cols || self.class.cols end def rows @rows || self.class.rows end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
avo-2.11.3.pre.3 | lib/avo/concerns/styles_cards.rb |
avo-2.11.3.pre.2 | lib/avo/concerns/styles_cards.rb |