Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix more previews #1719

Merged
merged 4 commits into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/chatty-walls-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/view-components": patch
---

Fix previews that used old slots API
76 changes: 38 additions & 38 deletions previews/primer/beta/border_box_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,47 @@ class BorderBoxPreview < ViewComponent::Preview
# @param scheme [Symbol] select [default, neutral, info, warning]
def playground(padding: :default, scheme: :default)
render(Primer::Beta::BorderBox.new(padding: padding)) do |component|
component.header { "Header" }
component.body { "Body" }
component.row(scheme: scheme) { "#{scheme.to_s.capitalize} row one" }
component.row(scheme: scheme) { "#{scheme.to_s.capitalize} row two" }
component.row(scheme: scheme) { "#{scheme.to_s.capitalize} row three" }
component.footer { "Footer" }
component.with_header { "Header" }
component.with_body { "Body" }
component.with_row(scheme: scheme) { "#{scheme.to_s.capitalize} row one" }
component.with_row(scheme: scheme) { "#{scheme.to_s.capitalize} row two" }
component.with_row(scheme: scheme) { "#{scheme.to_s.capitalize} row three" }
component.with_footer { "Footer" }
end
end

# @label Default
def default
render(Primer::Beta::BorderBox.new) do |component|
component.header { "Header" }
component.body { "Body" }
component.row { "Row one" }
component.row { "Row two" }
component.row { "Row three" }
component.footer { "Footer" }
component.with_header { "Header" }
component.with_body { "Body" }
component.with_row { "Row one" }
component.with_row { "Row two" }
component.with_row { "Row three" }
component.with_footer { "Footer" }
end
end

# @label Header with title
def header_with_title
render(Primer::Beta::BorderBox.new) do |component|
component.with_header do |h|
h.title(tag: :h2) do
component.with_header do |header|
header.with_title(tag: :h2) do
"Header with title"
end
end
component.body { "Body" }
component.footer { "Footer" }
component.with_body { "Body" }
component.with_footer { "Footer" }
end
end

# @label Row colors
def row_colors
render(Primer::Beta::BorderBox.new) do |component|
component.row(scheme: :default) { "Default" }
component.row(scheme: :neutral) { "Neutral" }
component.row(scheme: :info) { "Info" }
component.row(scheme: :warning) { "Warning" }
component.with_row(scheme: :default) { "Default" }
component.with_row(scheme: :neutral) { "Neutral" }
component.with_row(scheme: :info) { "Info" }
component.with_row(scheme: :warning) { "Warning" }
end
end

Expand All @@ -59,36 +59,36 @@ def row_colors
# @label Default
def padding_default
render(Primer::Beta::BorderBox.new) do |component|
component.header { "Header" }
component.body { "Body" }
component.row { "Row one" }
component.row { "Row two" }
component.row { "Row three" }
component.footer { "Footer" }
component.with_header { "Header" }
component.with_body { "Body" }
component.with_row { "Row one" }
component.with_row { "Row two" }
component.with_row { "Row three" }
component.with_footer { "Footer" }
end
end

# @label Condensed
def padding_condensed
render(Primer::Beta::BorderBox.new(padding: :condensed)) do |component|
component.header { "Header" }
component.body { "Body" }
component.row { "Row one" }
component.row { "Row two" }
component.row { "Row three" }
component.footer { "Footer" }
component.with_header { "Header" }
component.with_body { "Body" }
component.with_row { "Row one" }
component.with_row { "Row two" }
component.with_row { "Row three" }
component.with_footer { "Footer" }
end
end

# @label Spacious
def padding_spacious
render(Primer::Beta::BorderBox.new(padding: :spacious)) do |component|
component.header { "Header" }
component.body { "Body" }
component.row { "Row one" }
component.row { "Row two" }
component.row { "Row three" }
component.footer { "Footer" }
component.with_header { "Header" }
component.with_body { "Body" }
component.with_row { "Row one" }
component.with_row { "Row two" }
component.with_row { "Row three" }
component.with_footer { "Footer" }
end
end
#
Expand Down
4 changes: 2 additions & 2 deletions previews/primer/beta/breadcrumbs_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class BreadcrumbsPreview < ViewComponent::Preview
def playground(number_of_links: 2)
render(Primer::Beta::Breadcrumbs.new) do |component|
Array.new(number_of_links || 3) do |i|
component.item(href: "##{i}") { "Breadcrumb Item #{i + 1}" }
component.with_item(href: "##{i}") { "Breadcrumb Item #{i + 1}" }
end
end
end
Expand All @@ -21,7 +21,7 @@ def playground(number_of_links: 2)
def default(number_of_links: 2)
render(Primer::Beta::Breadcrumbs.new) do |component|
Array.new(number_of_links || 3) do |i|
component.item(href: "##{i}") { "Breadcrumb Item #{i + 1}" }
component.with_item(href: "##{i}") { "Breadcrumb Item #{i + 1}" }
end
end
end
Expand Down