From 49f257794525a5d6051bff109147b6133c7ee550 Mon Sep 17 00:00:00 2001 From: Keith Chong Date: Wed, 1 Dec 2021 18:03:17 -0500 Subject: [PATCH] feat: Allow customized Page and TopBar titles (#164) (#165) Signed-off-by: Keith Chong --- src/components/page/page.tsx | 6 ++++-- stories/page.tsx | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/components/page/page.tsx b/src/components/page/page.tsx index 8580f5a37c..74d30ee7b8 100644 --- a/src/components/page/page.tsx +++ b/src/components/page/page.tsx @@ -12,6 +12,8 @@ require('./page.scss'); interface PageProps extends React.Props { title: string; toolbar?: Toolbar | Observable; + topBarTitle?: string; + useTitleOnly?: boolean; } export interface PageContextProps { @@ -32,7 +34,7 @@ export const Page = (props: PageProps) => { {(ctx) => { let titleParts = [ctx.title]; - if (toolbar && toolbar.breadcrumbs && toolbar.breadcrumbs.length > 0) { + if (!props.useTitleOnly && toolbar && toolbar.breadcrumbs && toolbar.breadcrumbs.length > 0) { titleParts = [toolbar.breadcrumbs.map((item) => item.title).reverse().join(' / ')].concat(titleParts); } else if (props.title) { titleParts = [props.title].concat(titleParts); @@ -45,7 +47,7 @@ export const Page = (props: PageProps) => { }}
- +
)} diff --git a/stories/page.tsx b/stories/page.tsx index 686d00534c..4b7b859cf2 100644 --- a/stories/page.tsx +++ b/stories/page.tsx @@ -124,4 +124,18 @@ storiesOf('Page', module) ); - }); + }).add('custom top bar title', () => ( + + + + +
+
+ Test +
+
+
+
+
+
+ ));