Skip to content

Commit

Permalink
header component - added admin - page name to header (#5593)
Browse files Browse the repository at this point in the history
* header component - added admin - page name to header
* Make sectionName optional
  • Loading branch information
naveenbhaskar authored and akshaydewan committed Jan 2, 2019
1 parent 9563147 commit c05857a
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -40,6 +40,20 @@ $page-item-padding: 30px;
box-shadow: 0 0 10px $box-shadow-color;
}

.section-name {
display: inline-block;
color: $go-primary;
font-size: $header-font-size;
font-weight: $header-font-weight;
margin: 0;
&:after {
content: "|";
color: $line-color;
margin: 0 10px;

}
}

.title {
display: inline-block;
color: $text-color;
Expand Down
@@ -1,6 +1,7 @@
// This file is automatically generated by typings-for-css-modules.
// Please do not change this file!
export const pageHeader: string;
export const sectionName: string;
export const title: string;
export const page_title: string;
export const pageTitle: string;
Expand Up @@ -22,6 +22,7 @@ import * as style from "./index.scss";

export interface Attrs {
title: m.Children;
sectionName?: m.Children;
buttons?: m.Children;
}

Expand All @@ -39,9 +40,18 @@ export class HeaderPanel extends MithrilViewComponent<Attrs> {

return (<header className={style.pageHeader}>
<div class={style.pageTitle}>
{this.maybeSection(vnode)}
<h1 class={style.title} data-test-id="title">{vnode.attrs.title}</h1>
</div>
{buttons}
</header>);
}

private maybeSection(vnode: m.Vnode<Attrs>) {
if (vnode.attrs.sectionName) {
return (
<h1 className={style.sectionName} data-test-id="section-name">{vnode.attrs.sectionName}</h1>
);
}
}
}
Expand Up @@ -86,7 +86,6 @@
border-top: 10px solid $site-header;
}
}

&:hover {
@include ie-edge-fix-for-admin-dropdown
}
Expand Down
Expand Up @@ -50,7 +50,7 @@ export class KitchenSink extends MithrilViewComponent<null> {
view(vnode: m.Vnode<null>) {
return (
<div>
<HeaderPanel title="Kitchen Sink"/>
<HeaderPanel title="Kitchen Sink" sectionName={'Admin'}/>
<FlashMessage type={MessageType.info} message={"This page is awesome!"}/>
<FlashMessage type={MessageType.success} message={"Everything works as expected!"}/>
<FlashMessage type={MessageType.warning} message={"This might not work!"}/>
Expand Down

0 comments on commit c05857a

Please sign in to comment.