@@ -21,22 +21,32 @@ def default
2121 # @param with_back_button [Boolean]
2222 # @param back_button_size [Symbol] select [small, medium, large]
2323 # @param with_breadcrumbs [Boolean]
24+ # @param with_actions [Boolean]
25+ # @param with_context_bar_actions [Boolean]
26+ # @param with_parent_link [Boolean]
2427 def playground (
2528 variant : :medium ,
2629 title : "Hello" ,
2730 description : "Last updated 5 minutes ago by XYZ." ,
2831 with_back_button : false ,
2932 back_button_size : :medium ,
30- with_breadcrumbs : false
33+ with_breadcrumbs : false ,
34+ with_actions : false ,
35+ with_context_bar_actions : false ,
36+ with_parent_link : false
3137 )
3238 breadcrumb_items = [ { href : "/foo" , text : "Foo" } , { href : "/bar" , text : "Bar" } , "Baz" ]
3339
34- render ( Primer ::OpenProject ::PageHeader . new ) do |header |
35- header . with_title ( variant : variant ) { title }
36- header . with_description { description }
37- header . with_back_button ( href : "#" , size : back_button_size , 'aria-label' : "Back" ) if with_back_button
38- header . with_breadcrumbs ( breadcrumb_items ) if with_breadcrumbs
39- end
40+ render_with_template ( locals : { variant : variant ,
41+ title : title ,
42+ description : description ,
43+ with_back_button : with_back_button ,
44+ back_button_size : back_button_size ,
45+ with_breadcrumbs : with_breadcrumbs ,
46+ with_parent_link : with_parent_link ,
47+ with_actions : with_actions ,
48+ with_context_bar_actions : with_context_bar_actions ,
49+ breadcrumb_items : breadcrumb_items } )
4050 end
4151
4252 # @label Large
@@ -52,7 +62,11 @@ def actions
5262 render_with_template ( locals : { } )
5363 end
5464
55- # @label With back button
65+ # @label With back button (on wide)
66+ # **Back button** is only shown on **wider than narrow screens** by default.
67+ # If you want to override that behaviour please use the system_argument: **display**
68+ # e.g. **component.with\_breadcrumbs(display: [:block, :block])**
69+ #
5670 # @param href [String] text
5771 # @param size [Symbol] select [small, medium, large]
5872 # @param icon [String] select ["arrow-left", "chevron-left", "triangle-left"]
@@ -63,7 +77,11 @@ def back_button(href: "#", size: :medium, icon: "arrow-left")
6377 end
6478 end
6579
66- # @label With breadcrumbs
80+ # @label With breadcrumbs (on wide)
81+ # **Breadcrumbs** are only shown on **wider than narrow screens** by default.
82+ # If you want to override that behaviour please use the system_argument: **display**
83+ # e.g. **component.with\_breadcrumbs(display: [:block, :block])**
84+ #
6785 def breadcrumbs
6886 breadcrumb_items = [
6987 { href : "/foo" , text : "Foo" } ,
@@ -75,6 +93,27 @@ def breadcrumbs
7593 header . with_breadcrumbs ( breadcrumb_items )
7694 end
7795 end
96+
97+ # @label With parent link (on narrow)
98+ # **Parent link** is only shown on **narrow screens** by default.
99+ # If you want to override that behaviour please use the system_argument: **display**
100+ # e.g. **component.with\_parent\_link(display: [:block, :block])**
101+ #
102+ def parent_link
103+ render ( Primer ::OpenProject ::PageHeader . new ) do |header |
104+ header . with_title { "A title" }
105+ header . with_parent_link ( href : "test" ) { "Parent link" }
106+ end
107+ end
108+
109+ # @label With context bar actions (on narrow)
110+ # **Context bar actions** are only shown on **narrow screens** by default.
111+ # If you want to override that behaviour please use the system_argument: **display**
112+ # e.g. **component.with\_context\_bar\_actions(display: [:block, :block])**
113+ #
114+ def context_bar_actions
115+ render_with_template ( locals : { } )
116+ end
78117 end
79118 end
80119end
0 commit comments