Sha256: adfa94b9972e576c9e4931853323b45180ec6199f357c728a9e7d23f03d532bc
Contents?: true
Size: 1.26 KB
Versions: 12
Compression:
Stored size: 1.26 KB
Contents
# frozen_string_literal: true module Playbook module PbTimeStacked class TimeStacked < Playbook::KitBase prop :align, type: Playbook::Props::Enum, values: %w[left center right], default: "left" prop :classnames, type: Playbook::Props::String, default: nil prop :dark, type: Playbook::Props::Boolean, default: false prop :date, type: Playbook::Props::Date, required: true def classname generate_classname("pb_time_stacked_kit", dark_class) end def day day = Playbook::PbKit::PbDateTime.new(date) content_tag(:time, datetime: day.to_iso) do day.to_day.to_s end end def month month = Playbook::PbKit::PbDateTime.new(date) content_tag(:time, datetime: month.to_iso) do month.to_month.to_s end end def format_time_string "#{pb_date_time.to_full_hour}:#{pb_date_time.to_minutes}#{pb_date_time.to_meridian}" end def format_timezone pb_date_time.to_timezone end private def dark_class dark ? "dark" : nil end def pb_date_time Playbook::PbKit::PbDateTime.new(date) end end end end
Version data entries
12 entries across 12 versions & 1 rubygems