From 65745bf4c8044806a23e741eac0daf8e1fe65d53 Mon Sep 17 00:00:00 2001 From: Cameron Dutro Date: Fri, 12 May 2023 11:34:59 -0700 Subject: [PATCH 1/2] Fix select doc example (#2009) --- .changeset/forty-tomatoes-rule.md | 5 +++++ lib/primer/yard/lookbook_pages_backend.rb | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .changeset/forty-tomatoes-rule.md diff --git a/.changeset/forty-tomatoes-rule.md b/.changeset/forty-tomatoes-rule.md new file mode 100644 index 0000000000..7a5b83b50d --- /dev/null +++ b/.changeset/forty-tomatoes-rule.md @@ -0,0 +1,5 @@ +--- +'@primer/view-components': patch +--- + +Fix embedded example in SelectInput docs diff --git a/lib/primer/yard/lookbook_pages_backend.rb b/lib/primer/yard/lookbook_pages_backend.rb index a39bfb4f9e..d49272f987 100644 --- a/lib/primer/yard/lookbook_pages_backend.rb +++ b/lib/primer/yard/lookbook_pages_backend.rb @@ -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], @@ -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 From a1ca6fd0de5789f2b80fbc03257487dbe255b6f5 Mon Sep 17 00:00:00 2001 From: Cameron Dutro Date: Fri, 12 May 2023 13:07:16 -0700 Subject: [PATCH 2/2] Make ActionList leading visual icons the same color as the item text (#2011) --- .changeset/funny-tomatoes-sparkle.md | 5 +++++ app/components/primer/alpha/action_list/item.rb | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 .changeset/funny-tomatoes-sparkle.md diff --git a/.changeset/funny-tomatoes-sparkle.md b/.changeset/funny-tomatoes-sparkle.md new file mode 100644 index 0000000000..032da702bf --- /dev/null +++ b/.changeset/funny-tomatoes-sparkle.md @@ -0,0 +1,5 @@ +--- +'@primer/view-components': patch +--- + +Make ActionList leading visual icons the same color as the item text. diff --git a/app/components/primer/alpha/action_list/item.rb b/app/components/primer/alpha/action_list/item.rb index 4692d2b583..2d834ad45c 100644 --- a/app/components/primer/alpha/action_list/item.rb +++ b/app/components/primer/alpha/action_list/item.rb @@ -42,9 +42,7 @@ class Item < Primer::Component # # To render custom content, call the `with_leading_visual_content` method and pass a block that returns a string. renders_one :leading_visual, types: { - icon: lambda { |**system_arguments| - Primer::Beta::Octicon.new(classes: "ActionListItem-visual ActionListItem-visual--leading", **system_arguments) - }, + icon: Primer::Beta::Octicon, avatar: ->(**kwargs) { Primer::Beta::Avatar.new(**{ **kwargs, size: 16 }) }, svg: lambda { |**system_arguments| Primer::BaseComponent.new(tag: :svg, width: "16", height: "16", **system_arguments)