Sha256: 752489644f889ace047f77a62812adf29b32a2612eafe800a31391235e4d09e3

Contents?: true

Size: 806 Bytes

Versions: 5

Compression:

Stored size: 806 Bytes

Contents

# frozen_string_literal: true

# rubocop:disable Primer/ComponentNameMigration

module Primer
  # @label TimeAgoComponent
  class TimeAgoComponentPreview < ViewComponent::Preview
    # @label Playground
    #
    # @param time datetime-local
    # @param micro [Boolean] toggle
    def playground(time: Time.zone.now.to_s, micro: false)
      render(Primer::TimeAgoComponent.new(time: DateTime.parse(time), micro: micro))
    end

    # @param time datetime-local
    # @param micro [Boolean] toggle
    def default(time: Time.zone.now.to_s, micro: false)
      render(Primer::TimeAgoComponent.new(time: DateTime.parse(time), micro: micro))
    end

    def micro
      render(Primer::TimeAgoComponent.new(time: Time.zone.now, micro: true))
    end
  end
end
# rubocop:enable Primer/ComponentNameMigration

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
primer_view_components-0.0.120 previews/primer/time_ago_component_preview.rb
primer_view_components-0.0.119 previews/primer/time_ago_component_preview.rb
primer_view_components-0.0.118 previews/primer/time_ago_component_preview.rb
primer_view_components-0.0.117 previews/primer/time_ago_component_preview.rb
primer_view_components-0.0.116 previews/primer/time_ago_component_preview.rb