Skip to content

Commit

Permalink
Add config options to enable/disable preview and page search boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
allmarkedup committed Nov 22, 2023
1 parent 8b82290 commit 8430db4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
6 changes: 5 additions & 1 deletion app/views/layouts/lookbook/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@
<% end %>
<% end %>
<% end %>
<% nav.with_filter store: "$store.nav.previews.filter", placeholder: "Filter previews by name&hellip;" %>
<% if @config.preview_search %>
<% nav.with_filter store: "$store.nav.previews.filter", placeholder: "Filter previews by name&hellip;" %>
<% end %>
<% end %>
<% end %>
<% end %>
Expand All @@ -79,7 +81,9 @@
<% end %>
<% end %>
<% end %>
<% if @config.page_search %>
<% nav.with_filter store: "$store.nav.pages.filter", placeholder: "Filter pages by name&hellip;" %>
<% end %>
<% end %>
<% end %>
<% end %>
Expand Down
2 changes: 2 additions & 0 deletions config/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ shared:
project_logo: ~

preview_collection_label: "Previews"
preview_search: true
preview_paths: [test/components/previews]
preview_display_options: {}
preview_controller: "Lookbook::PreviewController"
Expand All @@ -24,6 +25,7 @@ shared:
preview_sort_scenarios: false

page_collection_label: "Pages"
page_search: false
page_controller: "Lookbook::PageController"
page_route: pages
page_paths: [test/components/docs]
Expand Down
4 changes: 2 additions & 2 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion docs/src/_data/config_options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ previews:
example: config.lookbook.preview_collection_label = "Component Previews"
description: The label used to denote the previews section of the sidebar nav.

- name: preview_search
types: Boolean
default: true
example: config.lookbook.preview_search = false
description: Whether or not to show a search/filter box for previews

- name: preview_paths
types: Array
default: "[]"
Expand Down Expand Up @@ -52,7 +58,7 @@ previews:

- name: preview_inspector.sidebar_panels
types: Array
default: '[:previews, :pages]'
default: "[:previews, :pages]"
example: config.lookbook.preview_inspector.sidebar_panels = [:pages, :previews]
description: Controls the order and availability of the sidebar navigation panels.

Expand Down Expand Up @@ -105,6 +111,12 @@ pages:
example: config.lookbook.page_collection_label = "Docs"
description: The label used to denote the pages section of the sidebar nav.

- name: page_search
types: Boolean
default: false
example: config.lookbook.page_search = false
description: Whether or not to show a search/filter box for pages

- name: page_paths
default: "[]"
types: Array
Expand Down

0 comments on commit 8430db4

Please sign in to comment.