Sha256: 98e7446e09b6679f6fd25cc5e13520f61d08e5e5e7b60211a2046fe84e85c780
Contents?: true
Size: 1.01 KB
Versions: 40
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true module Satis module ProgressBar class Component < Satis::ApplicationComponent attr_reader :percentage def initialize(percentage, size: :default, label: false) super @percentage = percentage @size = size @label = label end def label return if size == :small || size == :default if @label.is_a? FalseClass '' elsif @label.is_a? TrueClass "#{percentage}%" else @label end end def padding if @size == :large "p-0.5" elsif @size == :xlarge "p-1" end end def text_size if @size == :large "text-xs" elsif @size == :xlarge "text-sm" end end def size case @size when :small "h-1.5" when :large "h-4" when :xlarge "h-6" else "h-2" end end end end end
Version data entries
40 entries across 40 versions & 1 rubygems