Sha256: 5027fbcc1b3b6af5f5920257f165a6ce23f42fe2f22db9840a3316f45b63e154

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbUser
    class User
      include Playbook::Props

      partial "pb_user/user"

      prop :align, type: Playbook::Props::Enum,
                   values: %w[left center right],
                   default: "left"
      prop :avatar, type: Playbook::Props::Boolean,
                    default: false
      prop :avatar_url
      prop :name
      prop :orientation, type: Playbook::Props::Enum,
                         values: %w[vertical horizontal],
                         default: "horizontal"
      prop :size, type: Playbook::Props::Enum,
                  values: %w[lg md sm],
                  default: "sm"
      prop :title

      def classname
        generate_classname("pb_user_kit", align, orientation, size)
      end

      def avatar_size
        case size
        when "lg"
          "xl"
        when "md"
          "md"
        else
          "sm"
        end
      end

      def title_size
        size == "lg" ? 3 : 4
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
playbook_ui-2.9.9 app/pb_kits/playbook/pb_user/user.rb
playbook_ui-2.9.8 app/pb_kits/playbook/pb_user/user.rb
playbook_ui-2.9.7 app/pb_kits/playbook/pb_user/user.rb