File tree 2 files changed +19
-3
lines changed
2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ require('./page.scss');
12
12
interface PageProps extends React . Props < any > {
13
13
title : string ;
14
14
toolbar ?: Toolbar | Observable < Toolbar > ;
15
+ topBarTitle ?: string ;
16
+ useTitleOnly ?: boolean ;
15
17
}
16
18
17
19
export interface PageContextProps {
@@ -32,7 +34,7 @@ export const Page = (props: PageProps) => {
32
34
< PageContext . Consumer >
33
35
{ ( ctx ) => {
34
36
let titleParts = [ ctx . title ] ;
35
- if ( toolbar && toolbar . breadcrumbs && toolbar . breadcrumbs . length > 0 ) {
37
+ if ( ! props . useTitleOnly && toolbar && toolbar . breadcrumbs && toolbar . breadcrumbs . length > 0 ) {
36
38
titleParts = [ toolbar . breadcrumbs . map ( ( item ) => item . title ) . reverse ( ) . join ( ' / ' ) ] . concat ( titleParts ) ;
37
39
} else if ( props . title ) {
38
40
titleParts = [ props . title ] . concat ( titleParts ) ;
@@ -45,7 +47,7 @@ export const Page = (props: PageProps) => {
45
47
} }
46
48
</ PageContext . Consumer >
47
49
< div className = 'page__top-bar' >
48
- < TopBar title = { props . title } toolbar = { toolbar } />
50
+ < TopBar title = { props . topBarTitle ? props . topBarTitle : props . title } toolbar = { toolbar } />
49
51
</ div >
50
52
</ React . Fragment >
51
53
) }
Original file line number Diff line number Diff line change @@ -124,4 +124,18 @@ storiesOf('Page', module)
124
124
</ Route >
125
125
</ Router >
126
126
) ;
127
- } ) ;
127
+ } ) . add ( 'custom top bar title' , ( ) => (
128
+ < Router history = { history } >
129
+ < Route path = { location . pathname } >
130
+ < Layout navItems = { navItems } >
131
+ < Page title = 'helmet title' topBarTitle = 'Top Bar Title' toolbar = { { breadcrumbs : [ { title : 'Apps ' , path : '/applications' } , { title : 'app name' } ] } } >
132
+ < div style = { { padding : '1em' } } >
133
+ < div className = 'white-box' >
134
+ Test
135
+ </ div >
136
+ </ div >
137
+ </ Page >
138
+ </ Layout >
139
+ </ Route >
140
+ </ Router >
141
+ ) ) ;
You can’t perform that action at this time.
0 commit comments