Sha256: d7042e5b082ff51020a07aeec6c1f393c93f6aad7e6d5facc76e8d5fb3307ccb

Contents?: true

Size: 1.68 KB

Versions: 7

Compression:

Stored size: 1.68 KB

Contents

# frozen_string_literal: true

module Primer
  # @label LocalTime
  class LocalTimeComponentPreview < ViewComponent::Preview
    # @param datetime datetime-local
    # @param weekday [Symbol] select [long, short]
    # @param month [Symbol] select [long, short]
    # @param year [Symbol] select [numeric, "2-digit"]
    # @param day [Symbol] select [numeric, "2-digit"]
    # @param hour [Symbol] select [numeric, "2-digit"]
    # @param minute [Symbol] select [numeric, "2-digit"]
    # @param second [Symbol] select [numeric, "2-digit"]
    # @param time_zone_name [Symbol] select [long, short]
    def default(datetime: "2014-04-01T16:30:00-08:00", weekday: :short, month: :short, year: :numeric, day: :numeric, hour: :numeric, minute: :numeric, second: :numeric, time_zone_name: :short)
      render(Primer::LocalTime.new(datetime: DateTime.parse(datetime), weekday: weekday, month: month, year: year, day: day, hour: hour, minute: minute, second: second, time_zone_name: time_zone_name))
    end

    # @hidden
    def with_all_the_options
      render(Primer::LocalTime.new(
               datetime: DateTime.parse("2016-06-01T13:05:07Z"),
               weekday: :long,
               year: :"2-digit",
               month: :long,
               day: :"2-digit",
               hour: :"2-digit",
               minute: :"2-digit",
               second: :"2-digit",
               time_zone_name: :long
             ))
    end

    # @label With replaceable content
    #
    # @param initial_text [String] textarea
    def with_contents(initial_text: "This will be replaced")
      render Primer::LocalTime.new(datetime: DateTime.parse("2014-04-01T16:30:00-08:00"), initial_text: initial_text)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
primer_view_components-0.0.104 previews/primer/local_time_component_preview.rb
primer_view_components-0.0.103 previews/primer/local_time_component_preview.rb
primer_view_components-0.0.102 previews/primer/local_time_component_preview.rb
primer_view_components-0.0.101 previews/primer/local_time_component_preview.rb
primer_view_components-0.0.100 previews/primer/local_time_component_preview.rb
primer_view_components-0.0.99 previews/primer/local_time_component_preview.rb
primer_view_components-0.0.98 previews/primer/local_time_component_preview.rb