Skip to content

Commit

Permalink
fix(core): layout bug in top bar for brand section and right section
Browse files Browse the repository at this point in the history
close #330 - with a better solution, row wasn't going to work all the time
  • Loading branch information
mathSusan authored and pauljeter committed Sep 11, 2019
1 parent 4663d8e commit 35b4d0b
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 9 deletions.
3 changes: 3 additions & 0 deletions angular/src/lib/topbar/examples/examples.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
ExampleTopbarBlueComponent,
ExampleTopbarDarkComponent,
ExampleTopbarLightComponent,
ExampleTopbarNomiddleComponent
} from './index';

@NgModule({
Expand All @@ -27,11 +28,13 @@ import {
ExampleTopbarBlueComponent,
ExampleTopbarDarkComponent,
ExampleTopbarLightComponent,
ExampleTopbarNomiddleComponent
],
exports: [
ExampleTopbarBlueComponent,
ExampleTopbarDarkComponent,
ExampleTopbarLightComponent,
ExampleTopbarNomiddleComponent
],
})
export class TopbarExamplesModule {}
1 change: 1 addition & 0 deletions angular/src/lib/topbar/examples/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './blue.component';
export * from './dark.component';
export * from './light.component';
export * from './nomiddle.component';
39 changes: 39 additions & 0 deletions angular/src/lib/topbar/examples/nomiddle.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Component } from '@angular/core';

@Component({
selector: 'example-topbar-nomiddle',
template: `
<header md-top-bar color="light" [fixed]="true">
<ng-container
*ngTemplateOutlet="brand"
ngProjectAs="brand"
></ng-container>
<md-top-bar-right>
<div class="md-top-bar__user"></div>
<div class="md-top-bar__logged-out">
<a href="javascript:void(0)">Log In</a>
<button md-button color="blue" aria-label="myAriaLabel">
Button
</button>
</div>
</md-top-bar-right>
<md-top-bar-mobile [shouldCloseOnClick]="false">
<ng-container
*ngTemplateOutlet="brand"
ngProjectAs="brand"
></ng-container>
</md-top-bar-mobile>
</header>
<ng-template #brand>
<a
href="javascript:void(0)"
md-top-bar-brand
title="Momentum UI"
icon="icon-cisco-logo"
></a>
</ng-template>
`,
})
export class ExampleTopbarNomiddleComponent {}
2 changes: 1 addition & 1 deletion core/scss/components/top-bar/examples/blue.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<header class="md-top-bar md-top-bar--blue" role="navigation">
<div class="md-top-bar__container row">
<div class="md-top-bar__container">
<div class="md-top-bar__brand">
<a class="md-brand" href="/">
<div class="md-brand__logo">
Expand Down
2 changes: 1 addition & 1 deletion core/scss/components/top-bar/examples/default.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<header class="md-top-bar md-top-bar--dark" role="navigation">
<div class="md-top-bar__container row">
<div class="md-top-bar__container">
<div class="md-top-bar__brand">
<a class="md-brand" href="/">
<div class="md-brand__logo">
Expand Down
2 changes: 1 addition & 1 deletion core/scss/components/top-bar/examples/light.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<header class="md-top-bar md-top-bar--light" role="navigation">
<div class="md-top-bar__container row">
<div class="md-top-bar__container">
<div class="md-top-bar__brand">
<a class="md-brand" href="/">
<div class="md-brand__logo">
Expand Down
3 changes: 2 additions & 1 deletion core/scss/components/top-bar/top-bar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
flex: 0 1 auto;
align-items: center;
justify-content: flex-end;
order: 1;
margin-right: rem-calc(16);

.#{$top-bar-class}__user {
display: flex;
Expand Down Expand Up @@ -202,7 +204,6 @@
@media #{$large-up} {
flex: 0 1 auto;
margin-right: 0;
margin-left: rem-calc(-16);
}

@media #{$large-only} {
Expand Down
2 changes: 1 addition & 1 deletion react/src/lib/Topbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class Topbar extends React.Component {
ref={ref => {
this.parentContainer = ref;
}}>
<div className={`${mdTopBarClass}__container row`}>
<div className={`${mdTopBarClass}__container`}>
{brandNode}
{injectChildren}
</div>
Expand Down
8 changes: 4 additions & 4 deletions react/src/lib/Topbar/tests/__snapshots__/index.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ShallowWrapper {
"nodeType": "host",
"props": Object {
"children": <div
className="md-top-bar__container row"
className="md-top-bar__container"
>
<div
className="md-top-bar__brand"
Expand Down Expand Up @@ -85,7 +85,7 @@ ShallowWrapper {
</div>,
null,
],
"className": "md-top-bar__container row",
"className": "md-top-bar__container",
},
"ref": null,
"rendered": Array [
Expand Down Expand Up @@ -192,7 +192,7 @@ ShallowWrapper {
"nodeType": "host",
"props": Object {
"children": <div
className="md-top-bar__container row"
className="md-top-bar__container"
>
<div
className="md-top-bar__brand"
Expand Down Expand Up @@ -249,7 +249,7 @@ ShallowWrapper {
</div>,
null,
],
"className": "md-top-bar__container row",
"className": "md-top-bar__container",
},
"ref": null,
"rendered": Array [
Expand Down

0 comments on commit 35b4d0b

Please sign in to comment.