Skip to content

Commit

Permalink
chore[#50499]: Add toggles for back button and breadcrumbs in playground
Browse files Browse the repository at this point in the history
  • Loading branch information
dominic-braeunlein committed Nov 8, 2023
1 parent a0afd49 commit 7ee873c
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions previews/primer/open_project/page_header_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,22 @@ def default
# @param variant [Symbol] select [medium, large]
# @param title [String] text
# @param description [String] text
def playground(variant: :medium, title: "Hello", description: "Last updated 5 minutes ago by XYZ.")
# @param with_back_button [Boolean]
# @param with_breadcrumbs [Boolean]
def playground(
variant: :medium,
title: "Hello",
description: "Last updated 5 minutes ago by XYZ.",
with_back_button: false,
with_breadcrumbs: false
)
breadcrumb_items = [{ href: "/foo", text: "Foo" }, { href: "/bar", text: "Bar" }, "Baz"]

render(Primer::OpenProject::PageHeader.new) do |header|
header.with_title(variant: variant) { title }
header.with_description { description }
header.with_back_button(href: "#", 'aria-label': "Back") if with_back_button
header.with_breadcrumbs(breadcrumb_items) if with_breadcrumbs
end
end

Expand All @@ -44,20 +56,20 @@ def actions
# @param icon [String] select ["arrow-left", "chevron-left", "triangle-left"]
def back_button(href: "#", size: :medium, icon: "arrow-left")
render(Primer::OpenProject::PageHeader.new) do |header|
header.with_title() { "Hello" }
header.with_title { "Hello" }
header.with_back_button(href: href, size: size, icon: icon, 'aria-label': "Back")
end
end

# @label With breadcrumbs
def breadcrumbs
breadcrumb_items = [
{href: "/foo", text: "Foo"},
"\u003ca href=\"/foo/bar\"\u003eBar\u003c/a\u003e" ,
{ href: "/foo", text: "Foo" },
"\u003ca href=\"/foo/bar\"\u003eBar\u003c/a\u003e",
"Baz"
]
render(Primer::OpenProject::PageHeader.new) do |header|
header.with_title() { "A title" }
header.with_title { "A title" }
header.with_breadcrumbs(breadcrumb_items)
end
end
Expand Down

0 comments on commit 7ee873c

Please sign in to comment.