class Dedalus::PatternLibrary::LibrarySectionTab

Attributes

description[RW]
highlight[RW]
icon[RW]
name[RW]
scale[RW]
section_color[RW]

Public Class Methods

description() click to toggle source
# File lib/dedalus/pattern_library/molecules/library_section_tab.rb, line 47
def self.description
  "navigational tab"
end
example_data() click to toggle source
# File lib/dedalus/pattern_library/molecules/library_section_tab.rb, line 51
def self.example_data
  {
    icon: :house,
    name: "Welcome",
    description: "Hello world (links to Welcome)",
    highlight: false,
    section_color: 'gray'
  }
end

Public Instance Methods

background_color() click to toggle source
# File lib/dedalus/pattern_library/molecules/library_section_tab.rb, line 18
def background_color
  bg = Palette.decode_color(section_color)
  self.highlight ? bg.lighten : bg
end
click() click to toggle source
# File lib/dedalus/pattern_library/molecules/library_section_tab.rb, line 23
def click
  view.route_to(name)
end
description_element() click to toggle source
# File lib/dedalus/pattern_library/molecules/library_section_tab.rb, line 43
def description_element
  TinyText.new(text: description)
end
height() click to toggle source
# File lib/dedalus/pattern_library/molecules/library_section_tab.rb, line 31
def height
  @height ||= 80
end
hover() click to toggle source
# File lib/dedalus/pattern_library/molecules/library_section_tab.rb, line 14
def hover
  self.scale = 1.05
end
icon_element() click to toggle source
# File lib/dedalus/pattern_library/molecules/library_section_tab.rb, line 35
def icon_element
  Elements::Icon.for(icon, padding: 10)
end
show() click to toggle source
# File lib/dedalus/pattern_library/molecules/library_section_tab.rb, line 6
def show
  Container.new(
    [[icon_element, [ title_element, description_element ]]],
    padding: 16,
    scale: scale
  )
end
title_element() click to toggle source
# File lib/dedalus/pattern_library/molecules/library_section_tab.rb, line 39
def title_element
  Elements::Heading.new(text: name, scale: scale)
end