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

Update slot use in examples for all components in the root folder #1294

Merged
merged 3 commits into from
Aug 10, 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/perfect-chefs-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/view-components': patch
---

updating slot use for examples in all components in the root component folder
2 changes: 1 addition & 1 deletion app/components/primer/blankslate_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class BlankslateComponent < Primer::Component
# title: "Title",
# description: "Description",
# ) do |component| %>
# <% component.spinner(size: :large) %>
# <% component.with_spinner(size: :large) %>
# <% end %>
#
# @example Custom content
Expand Down
10 changes: 5 additions & 5 deletions app/components/primer/button_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,20 @@ class ButtonComponent < Primer::Component
#
# @example With leading visual
# <%= render(Primer::ButtonComponent.new) do |c| %>
# <% c.leading_visual_icon(icon: :star) %>
# <% c.with_leading_visual_icon(icon: :star) %>
# Button
# <% end %>
#
# @example With trailing visual
# <%= render(Primer::ButtonComponent.new) do |c| %>
# <% c.trailing_visual_counter(count: 15) %>
# <% c.with_trailing_visual_counter(count: 15) %>
# Button
# <% end %>
#
# @example With leading and trailing visuals
# <%= render(Primer::ButtonComponent.new) do |c| %>
# <% c.leading_visual_icon(icon: :star) %>
# <% c.trailing_visual_counter(count: 15) %>
# <% c.with_leading_visual_icon(icon: :star) %>
# <% c.with_trailing_visual_counter(count: 15) %>
# Button
# <% end %>
#
Expand All @@ -116,7 +116,7 @@ class ButtonComponent < Primer::Component
# Use tooltips sparingly and as a last resort. Consult the <%= link_to_component(Primer::Alpha::Tooltip) %> documentation for more information.
# @code
# <%= render(Primer::ButtonComponent.new(id: "button-with-tooltip")) do |c| %>
# <% c.tooltip(text: "Tooltip text") %>
# <% c.with_tooltip(text: "Tooltip text") %>
# Button
# <% end %>
#
Expand Down
4 changes: 2 additions & 2 deletions app/components/primer/details_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ class DetailsComponent < Primer::Component
# @example Default
#
# <%= render Primer::DetailsComponent.new do |c| %>
# <% c.summary do %>
# <% c.with_summary do %>
# Summary
# <% end %>
# <% c.body do %>
# <% c.with_body do %>
# Body
# <% end %>
# <% end %>
Expand Down
28 changes: 14 additions & 14 deletions app/components/primer/dropdown.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ class Dropdown < Primer::Component

# @example Default
# <%= render(Primer::Dropdown.new) do |c| %>
# <% c.button do %>
# <% c.with_button do %>
# Dropdown
# <% end %>
#
# <% c.menu(header: "Options") do |menu|
# <% c.with_menu(header: "Options") do |menu|
# menu.item { "Item 1" }
# menu.item { "Item 2" }
# menu.item { "Item 3" }
Expand All @@ -42,11 +42,11 @@ class Dropdown < Primer::Component
# Dividers can be used to separate a group of items. They don't have any content.
# @code
# <%= render(Primer::Dropdown.new) do |c| %>
# <% c.button do %>
# <% c.with_button do %>
# Dropdown
# <% end %>
#
# <% c.menu(header: "Options") do |menu|
# <% c.with_menu(header: "Options") do |menu|
# menu.item { "Item 1" }
# menu.item { "Item 2" }
# menu.item(divider: true)
Expand All @@ -60,11 +60,11 @@ class Dropdown < Primer::Component
#
# @example With direction
# <%= render(Primer::Dropdown.new(display: :inline_block)) do |c| %>
# <% c.button do %>
# <% c.with_button do %>
# Dropdown
# <% end %>
#
# <% c.menu(header: "Options", direction: :s) do |menu|
# <% c.with_menu(header: "Options", direction: :s) do |menu|
# menu.item { "Item 1" }
# menu.item { "Item 2" }
# menu.item { "Item 3" }
Expand All @@ -74,11 +74,11 @@ class Dropdown < Primer::Component
#
# @example With caret
# <%= render(Primer::Dropdown.new(with_caret: true)) do |c| %>
# <% c.button do %>
# <% c.with_button do %>
# Dropdown
# <% end %>
#
# <% c.menu(header: "Options") do |menu|
# <% c.with_menu(header: "Options") do |menu|
# menu.item { "Item 1" }
# menu.item { "Item 2" }
# menu.item { "Item 3" }
Expand All @@ -88,11 +88,11 @@ class Dropdown < Primer::Component
#
# @example Customizing the button
# <%= render(Primer::Dropdown.new) do |c| %>
# <% c.button(scheme: :primary, size: :small) do %>
# <% c.with_button(scheme: :primary, size: :small) do %>
# Dropdown
# <% end %>
#
# <% c.menu(header: "Options") do |menu|
# <% c.with_menu(header: "Options") do |menu|
# menu.item { "Item 1" }
# menu.item { "Item 2" }
# menu.item { "Item 3" }
Expand All @@ -102,11 +102,11 @@ class Dropdown < Primer::Component
#
# @example Menu as list
# <%= render(Primer::Dropdown.new) do |c| %>
# <% c.button do %>
# <% c.with_button do %>
# Dropdown
# <% end %>
#
# <% c.menu(as: :list, header: "Options") do |menu|
# <% c.with_menu(as: :list, header: "Options") do |menu|
# menu.item { "Item 1" }
# menu.item { "Item 2" }
# menu.item(divider: true)
Expand All @@ -117,11 +117,11 @@ class Dropdown < Primer::Component
#
# @example Customizing menu items
# <%= render(Primer::Dropdown.new) do |c| %>
# <% c.button do %>
# <% c.with_button do %>
# Dropdown
# <% end %>
#
# <% c.menu(header: "Options") do |menu|
# <% c.with_menu(header: "Options") do |menu|
# menu.item(tag: :button) { "Item 1" }
# menu.item(classes: "custom-class") { "Item 2" }
# menu.item { "Item 3" }
Expand Down
2 changes: 1 addition & 1 deletion app/components/primer/image_crop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ImageCrop < Primer::Component
#
# @example Cropper with a custom loader
# <%= render(Primer::ImageCrop.new(src: "https://github.com/koddsson.png", rounded: false)) do |cropper| %>
# <% cropper.loading(style: "width: 120px").with_content("Loading...") %>
# <% cropper.with_loading(style: "width: 120px").with_content("Loading...") %>
# <% end %>
#
# @param src [String] The path of the image to crop.
Expand Down
8 changes: 4 additions & 4 deletions app/components/primer/layout_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ class LayoutComponent < Primer::Component

# @example Default
# <%= render(Primer::LayoutComponent.new) do |component| %>
# <% component.sidebar { "Sidebar" } %>
# <% component.main { "Main" } %>
# <% component.with_sidebar { "Sidebar" } %>
# <% component.with_main { "Main" } %>
# <% end %>
#
# @example Left sidebar
# <%= render(Primer::LayoutComponent.new(side: :left)) do |component| %>
# <% component.sidebar { "Sidebar" } %>
# <% component.main { "Main" } %>
# <% component.with_sidebar { "Sidebar" } %>
# <% component.with_main { "Main" } %>
# <% end %>
#
# @param responsive [Boolean] Whether to collapse layout to a single column at smaller widths.
Expand Down
2 changes: 1 addition & 1 deletion app/components/primer/link_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class LinkComponent < Primer::Component
# Use tooltips sparingly and as a last resort. Consult the <%= link_to_component(Primer::Alpha::Tooltip) %> documentation for more information.
# @code
# <%= render(Primer::LinkComponent.new(href: "#", id: "link-with-tooltip")) do |c| %>
# <% c.tooltip(text: "Tooltip text") %>
# <% c.with_tooltip(text: "Tooltip text") %>
# Link
# <% end %>
#
Expand Down
8 changes: 4 additions & 4 deletions app/components/primer/menu_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ class MenuComponent < Primer::Component

# @example Default
# <%= render(Primer::MenuComponent.new) do |c| %>
# <% c.heading(tag: :h2) do %>
# <% c.with_heading(tag: :h2) do %>
# Heading
# <% end %>
# <% c.item(selected: true, href: "#url") do %>
# <% c.with_item(selected: true, href: "#url") do %>
# Item 1
# <% end %>
# <% c.item(href: "#url") do %>
# <% c.with_item(href: "#url") do %>
# <%= render(Primer::OcticonComponent.new("check")) %>
# With Icon
# <% end %>
# <% c.item(href: "#url") do %>
# <% c.with_item(href: "#url") do %>
# <%= render(Primer::OcticonComponent.new("check")) %>
# With Icon and Counter
# <%= render(Primer::Beta::Counter.new(count: 25)) %>
Expand Down
20 changes: 10 additions & 10 deletions app/components/primer/navigation/tab_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,30 +64,30 @@ class TabComponent < Primer::Component

# @example Default
# <%= render(Primer::Navigation::TabComponent.new(selected: true)) do |c| %>
# <% c.text { "Selected" } %>
# <% c.with_text { "Selected" } %>
# <% end %>
# <%= render(Primer::Navigation::TabComponent.new) do |c| %>
# <% c.text { "Not selected" } %>
# <% c.with_text { "Not selected" } %>
# <% end %>
#
# @example With icons and counters
# <%= render(Primer::Navigation::TabComponent.new) do |c| %>
# <% c.icon(:star) %>
# <% c.text { "Tab" } %>
# <% c.with_icon(:star) %>
# <% c.with_text { "Tab" } %>
# <% end %>
# <%= render(Primer::Navigation::TabComponent.new) do |c| %>
# <% c.icon(:star) %>
# <% c.text { "Tab" } %>
# <% c.counter(count: 10) %>
# <% c.with_icon(:star) %>
# <% c.with_text { "Tab" } %>
# <% c.with_counter(count: 10) %>
# <% end %>
# <%= render(Primer::Navigation::TabComponent.new) do |c| %>
# <% c.text { "Tab" } %>
# <% c.counter(count: 10) %>
# <% c.with_text { "Tab" } %>
# <% c.with_counter(count: 10) %>
# <% end %>
#
# @example Inside a list
# <%= render(Primer::Navigation::TabComponent.new(list: true)) do |c| %>
# <% c.text { "Tab" } %>
# <% c.with_text { "Tab" } %>
# <% end %>
#
# @example With custom HTML
Expand Down
16 changes: 8 additions & 8 deletions app/components/primer/popover_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,40 +60,40 @@ class PopoverComponent < Primer::Component

# @example Default
# <%= render Primer::PopoverComponent.new do |component| %>
# <% component.heading do %>
# <% component.with_heading do %>
# Activity feed
# <% end %>
# <% component.body do %>
# <% component.with_body do %>
# This is the Popover body.
# <% end %>
# <% end %>
#
# @example Large
# <%= render Primer::PopoverComponent.new do |component| %>
# <% component.heading do %>
# <% component.with_heading do %>
# Activity feed
# <% end %>
# <% component.body(large: true) do %>
# <% component.with_body(large: true) do %>
# This is the large Popover body.
# <% end %>
# <% end %>
#
# @example Caret position
# <%= render Primer::PopoverComponent.new do |component| %>
# <% component.heading do %>
# <% component.with_heading do %>
# Activity feed
# <% end %>
# <% component.body(caret: :left) do %>
# <% component.with_body(caret: :left) do %>
# This is the Popover body.
# <% end %>
# <% end %>
#
# @example With multiple elements in the body
# <%= render Primer::PopoverComponent.new do |component| %>
# <% component.heading do %>
# <% component.with_heading do %>
# Activity feed
# <% end %>
# <% component.body(caret: :left) do %>
# <% component.with_body(caret: :left) do %>
# <p>This is the Popover body.</p>
# <%= render Primer::ButtonComponent.new(type: :submit) do %>
# Got it!
Expand Down
20 changes: 10 additions & 10 deletions app/components/primer/subhead_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,51 +56,51 @@ class SubheadComponent < Primer::Component

# @example Default
# <%= render(Primer::SubheadComponent.new) do |component| %>
# <% component.heading(tag: :h3) do %>
# <% component.with_heading(tag: :h3) do %>
# My Heading
# <% end %>
# <% component.description do %>
# <% component.with_description do %>
# My Description
# <% end %>
# <% end %>
#
# @example With dangerous heading
# <%= render(Primer::SubheadComponent.new) do |component| %>
# <% component.heading(tag: :h3, danger: true) do %>
# <% component.with_heading(tag: :h3, danger: true) do %>
# My Heading
# <% end %>
# <% component.description do %>
# <% component.with_description do %>
# My Description
# <% end %>
# <% end %>
#
# @example With long description
# <%= render(Primer::SubheadComponent.new) do |component| %>
# <% component.heading(tag: :h3) do %>
# <% component.with_heading(tag: :h3) do %>
# My Heading
# <% end %>
# <% end %>
# <p> This is a longer description that is sitting below the Subhead. It's much longer than a description that could sit comfortably in the Subhead. </p>
#
# @example Without border
# <%= render(Primer::SubheadComponent.new(hide_border: true)) do |component| %>
# <% component.heading do %>
# <% component.with_heading do %>
# My Heading
# <% end %>
# <% component.description do %>
# <% component.with_description do %>
# My Description
# <% end %>
# <% end %>
#
# @example With actions
# <%= render(Primer::SubheadComponent.new) do |component| %>
# <% component.heading do %>
# <% component.with_heading do %>
# My Heading
# <% end %>
# <% component.description do %>
# <% component.with_description do %>
# My Description
# <% end %>
# <% component.actions do %>
# <% component.with_actions do %>
# <%= render(
# Primer::ButtonComponent.new(
# tag: :a, href: "http://www.google.com", scheme: :danger
Expand Down
6 changes: 3 additions & 3 deletions app/components/primer/timeline_item_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ class TimelineItemComponent < Primer::Component
# @example Default
# <div style="padding-left: 60px">
# <%= render(Primer::TimelineItemComponent.new) do |component| %>
# <% component.avatar(src: "https://github.com/github.png", alt: "github") %>
# <% component.badge(bg: :success_emphasis, color: :on_emphasis, icon: :check) %>
# <% component.body { "Success!" } %>
# <% component.with_avatar(src: "https://github.com/github.png", alt: "github") %>
# <% component.with_badge(bg: :success_emphasis, color: :on_emphasis, icon: :check) %>
# <% component.with_body { "Success!" } %>
# <% end %>
# </div>
#
Expand Down