Class: Maglev::Uikit::PageActionsDropdownComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/maglev/uikit/page_actions_dropdown_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseComponent

#button_class_names

Constructor Details

#initialize(paths:, live_url:, without_actions: [], icon_direction: :vertical) ⇒ PageActionsDropdownComponent

Returns a new instance of PageActionsDropdownComponent.



8
9
10
11
12
13
# File 'app/components/maglev/uikit/page_actions_dropdown_component.rb', line 8

def initialize(paths:, live_url:, without_actions: [], icon_direction: :vertical)
  @paths = paths
  @live_url = live_url
  @without_actions = without_actions
  @icon_direction = icon_direction
end

Instance Attribute Details

#icon_directionObject (readonly)

Returns the value of attribute icon_direction.



6
7
8
# File 'app/components/maglev/uikit/page_actions_dropdown_component.rb', line 6

def icon_direction
  @icon_direction
end

#live_urlObject (readonly)

Returns the value of attribute live_url.



6
7
8
# File 'app/components/maglev/uikit/page_actions_dropdown_component.rb', line 6

def live_url
  @live_url
end

#pathsObject (readonly)

Returns the value of attribute paths.



6
7
8
# File 'app/components/maglev/uikit/page_actions_dropdown_component.rb', line 6

def paths
  @paths
end

#without_actionsObject (readonly)

Returns the value of attribute without_actions.



6
7
8
# File 'app/components/maglev/uikit/page_actions_dropdown_component.rb', line 6

def without_actions
  @without_actions
end

Instance Method Details

#allow?(action) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'app/components/maglev/uikit/page_actions_dropdown_component.rb', line 15

def allow?(action)
  !without_actions.include?(action)
end

#icon_nameObject



19
20
21
# File 'app/components/maglev/uikit/page_actions_dropdown_component.rb', line 19

def icon_name
  icon_direction == :vertical ? 'more_2' : 'more'
end