Sha256: 38cc5eb08e3a9b58b5c3d35a192900ce98ef9efb512c2c629b61edbae6adbe76

Contents?: true

Size: 971 Bytes

Versions: 170

Compression:

Stored size: 971 Bytes

Contents

# frozen_string_literal: true

require "action_view"

module Playbook
  module PbContact
    class Contact < Playbook::KitBase
      prop :contact_type
      prop :contact_value
      prop :contact_detail

      def classname
        generate_classname("pb_contact_kit")
      end

      def contact_icon
        case contact_type
        when "cell"
          "mobile"
        when "home"
          "phone"
        when "work"
          "phone-office"
        when "email"
          "envelope"
        when "work-cell"
          "phone-laptop"
        when "wrong-phone"
          "phone-slash"
        else # "unknown" || "other"
          "phone"
        end
      end

      def formatted_contact_value
        if contact_type == "email"
          contact_value
        else
          number_to_phone(formatted_value, area_code: true)
        end
      end

    private

      def formatted_value
        contact_value.to_s.gsub(/\D/, "")
      end
    end
  end
end

Version data entries

170 entries across 170 versions & 1 rubygems

Version Path
playbook_ui-10.25.0 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-10.25.0.pre.alpha3 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-10.25.0.pre.treeshaking1 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-10.24.0 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-10.24.0.pre.alpha1 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-10.23.0 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-10.23.0.pre.alpha2 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-10.23.0.pre.cachetest app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-10.23.0.pre.alpha1 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-10.22.1 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-10.22.0 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-10.21.1.pre.alpha1 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-10.21.0.pre.alpha.lightbox.2 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-10.21.0 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-10.21.0.pre.alpha.lightbox app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-10.21.0.pre.alpha.rg1 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-10.21.0.pre.alpha.jg1 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-10.21.0.pre.alpha.na1 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-10.21.0.pre.alpha.jd1 app/pb_kits/playbook/pb_contact/contact.rb
playbook_ui-10.20.0 app/pb_kits/playbook/pb_contact/contact.rb