Sha256: 7b266510b0effb0684430f7c03b9d8d9ffc02b7c33f3425c7e6b0a2399f0ce72

Contents?: true

Size: 1.14 KB

Versions: 14

Compression:

Stored size: 1.14 KB

Contents

module Dedalus
  module PatternLibrary
    class LibrarySectionTab < Dedalus::Molecule
      attr_accessor :icon, :name, :description, :scale, :highlight, :section_color

      def show
        Container.new([[icon_element, [ title_element, description_element ]]], padding: 16)
      end

      def hover
        @scale = 0.2
      end

      def background_color
        bg = Palette.decode_color(section_color)
        self.highlight ? bg.lighten : bg
      end

      def click
        view.route_to(name)
      end

      def scale
        @scale ||= 0.0
      end

      def height
        @height ||= 80
      end

      def icon_element
        Elements::Icon.for(icon, padding: 10)
      end

      def title_element
        Elements::Heading.new(text: name)
      end

      def description_element
        TinyText.new(text: description)
      end

      def self.description
        "navigational tab"
      end

      def self.example_data
        {
          icon: :house,
          name: "Welcome",
          description: "Hello world (links to Welcome)",
          highlight: false,
          section_color: 'gray'
        }
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
dedalus-0.2.17 lib/dedalus/pattern_library/molecules/library_section_tab.rb
dedalus-0.2.16 lib/dedalus/pattern_library/molecules/library_section_tab.rb
dedalus-0.2.15 lib/dedalus/pattern_library/molecules/library_section_tab.rb
dedalus-0.2.13 lib/dedalus/pattern_library/molecules/library_section_tab.rb
dedalus-0.2.12 lib/dedalus/pattern_library/molecules/library_section_tab.rb
dedalus-0.2.11 lib/dedalus/pattern_library/molecules/library_section_tab.rb
dedalus-0.2.10 lib/dedalus/pattern_library/molecules/library_section_tab.rb
dedalus-0.2.9 lib/dedalus/pattern_library/molecules/library_section_tab.rb
dedalus-0.2.8 lib/dedalus/pattern_library/molecules/library_section_tab.rb
dedalus-0.2.7 lib/dedalus/pattern_library/molecules/library_section_tab.rb
dedalus-0.2.6 lib/dedalus/pattern_library/molecules/library_section_tab.rb
dedalus-0.2.5 lib/dedalus/pattern_library/molecules/library_section_tab.rb
dedalus-0.2.4 lib/dedalus/pattern_library/molecules/library_section_tab.rb
dedalus-0.2.3 lib/dedalus/pattern_library/molecules/library_section_tab.rb