Sha256: 83f51d2503c107ef5cdb252aef6d907a5168a318ffadb1cf9a4a212b0aa6fc65
Contents?: true
Size: 948 Bytes
Versions: 11
Compression:
Stored size: 948 Bytes
Contents
module Lookbook class Nav::Entity::Component < Nav::Item::Component ICONS = { page: :file, preview: :layers, example: :eye, group: :eye }.freeze def nav_icon ICONS[collapsed? ? :preview : node.type] || :file end def href if collapsed? node.first.url_path elsif type != :preview node.url_path end end def children collapsed? ? [] : super end def type collapsed? ? :example : node.type end def collapsed? node.type == :preview && node.children.one? end def search_terms matchers = if collapsed? node.first.search_terms else node.respond_to?(:search_terms) ? Array(node.search_terms) : [] end matchers.flatten.map { |m| m.gsub(/\s/, "").downcase } end protected def alpine_data alpine_encode({id: node.id, matchers: search_terms}) end end end
Version data entries
11 entries across 11 versions & 1 rubygems