Sha256: 7a4e43600825948014a5521085fe2b50355f25a48ca43c18797aa20428864fa7
Contents?: true
Size: 1.53 KB
Versions: 1206
Compression:
Stored size: 1.53 KB
Contents
# frozen_string_literal: true module Playbook module PbAvatarActionButton class AvatarActionButton < Playbook::KitBase prop :action, type: Playbook::Props::String, default: "add" prop :link_aria_label, type: Playbook::Props::String prop :image_alt, type: Playbook::Props::String prop :image_url, type: Playbook::Props::String prop :link_url, type: Playbook::Props::String, default: "#" prop :tooltip_text, type: Playbook::Props::String prop :tooltip_id, type: Playbook::Props::String prop :name, type: Playbook::Props::String, default: "" prop :size, type: Playbook::Props::Enum, values: %w[xs sm md lg xl], default: "md" prop :placement, type: Playbook::Props::Enum, values: %w[bottom_left bottom_right top_left top_right], default: "bottom_left" def classname generate_classname("pb_avatar_action_button_kit", action, size, placement) end def action_icons icon_hash = { add: "plus-circle", remove: "times-circle", } # if an 'action' prop is passed that isn't # in the icon_hash an empty string is returned # instead of a null value, which would break the page # double pipe ruby syntax below is essentially a reduced if-else statement # if icon_hash[action.to_sym] returns a falsey value, return "" instead icon_hash[action.to_sym] ||= "" end end end end
Version data entries
1,206 entries across 1,206 versions & 1 rubygems