app/components/lookbook/debug_menu/component.rb in lookbook-1.5.5 vs app/components/lookbook/debug_menu/component.rb in lookbook-2.0.0.beta.0
- old
+ new
@@ -1,11 +1,22 @@
module Lookbook
class DebugMenu::Component < Lookbook::BaseComponent
- def initialize(version: nil, docs_url: nil, repo_url: nil, **html_attrs)
+ attr_reader :features
+
+ def initialize(version: nil, docs_url: nil, repo_url: nil, features: {}, **html_attrs)
@version = version
@docs_url = docs_url
@repo_url = repo_url
+ @features = features
super(**html_attrs)
+ end
+
+ def auto_refresh_enabled?
+ feature(:auto_refresh, false)
+ end
+
+ def feature(name, fallback = nil)
+ features.fetch(name.to_sym, fallback)
end
def debug_data
content
end