Skip to content

Commit

Permalink
Fix select doc example (#2009)
Browse files Browse the repository at this point in the history
  • Loading branch information
camertron authored May 12, 2023
1 parent 0cc6910 commit 65745bf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/forty-tomatoes-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/view-components': patch
---

Fix embedded example in SelectInput docs
8 changes: 7 additions & 1 deletion lib/primer/yard/lookbook_pages_backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class LookbookPage
PREVIEW_MAP = {
Primer::Alpha::TextField => [:single_text_field_form, :multi_text_field_form],
Primer::Alpha::TextArea => [],
Primer::Alpha::Select => [:select_list_form],
Primer::Alpha::Select => [:select_form],
Primer::Alpha::MultiInput => [:multi_input_form],
Primer::Alpha::RadioButton => [:radio_button_with_nested_form],
Primer::Alpha::RadioButtonGroup => [:radio_button_group_form],
Expand Down Expand Up @@ -49,6 +49,12 @@ def generate

preview_methods = PREVIEW_MAP[component]
preview_erbs = preview_methods.map do |preview_method|
# rubocop:disable Style/IfUnlessModifier
if Primer::Forms::FormsPreview.instance_methods.exclude?(preview_method)
raise "Preview '#{preview_method}' does not exist in Primer::Forms::FormsPreview"
end
# rubocop:enable Style/IfUnlessModifier

"<%= embed Primer::Forms::FormsPreview, #{preview_method.inspect} %>"
end
# rubocop:enable Lint/UselessAssignment
Expand Down

0 comments on commit 65745bf

Please sign in to comment.