Skip to content

feat(layout): introducing layout toggle directives#657

Merged
emoralesb05 merged 15 commits into
developfrom
feature/layout-toggles
Jul 4, 2017
Merged

feat(layout): introducing layout toggle directives#657
emoralesb05 merged 15 commits into
developfrom
feature/layout-toggles

Conversation

@emoralesb05

@emoralesb05 emoralesb05 commented Jun 4, 2017

Copy link
Copy Markdown
Contributor

to allow more flexibility using td-layout, td-layout-nav-list and td-layout-manage-list we removed the toggle button from the component and created a few toggle directives so developers can pick and choose how, what and when to add them

What's included?

  • [tdLayoutToggle], [tdLayoutNavListToggle] and [tdLayoutManageListToggle] directives.
  • Removed toggle buttons from td-layout-nav-list and td-layout-manage-list in favor of these directives.

e.g.

<button md-icon-button tdLayoutManageListToggle [hideWhenOpened]="true">
   <md-icon>arrow_back</md-icon>
</button>

AND

<button md-icon-button tdLayoutNavListToggle [hideWhenOpened]="true">
   <md-icon>arrow_back</md-icon>
</button>
  • Removed embedded md-toolbar from td-layout-manage-list to make it more flexible.

e.g.

  <td-layout-manage-list>
    <md-toolbar td-sidenav-content>
      ... toolbar in sidenav
    </md-toolbar>
    <md-nav-list td-sidenav-content>
      ... sidenav content
    </md-nav-list>
    <md-toolbar>
      <button md-icon-button tdLayoutManageListToggle [hideWhenOpened]="true">
        <md-icon>arrow_back</md-icon>
      </button>
      ... sub toolbar content
    </md-toolbar>
    ... main content
  </td-layout-manage-list>
  • feat(): removing internal dependency to td-layout in td-layout-nav

before we needed to check if td-layout-nav was a child component of any td-layout wrapper. now we will remove that dependency all together and the menu button in favor of a [td-menu-button] placeholder so users can add their own button and add [tdLayoutToggle] or their own sidenav.

e.g.

<td-layout>
  <td-layout-nav toolbarTitle="Covalent">
    <button md-icon-button td-menu-button tdLayoutToggle>
      <md-icon>menu</md-icon>
    </button>

OR

<td-layout-nav toolbarTitle="Covalent">
  <button md-icon-button td-menu-button (click)="openSomethingElse()">
    <md-icon>menu</md-icon>
  </button>

The purpose of all this is to make layouts more flexible to allow this sort of thing:

<td-layout>
  <td-layout-nav>
     <button md-icon-button td-menu-button tdLayoutToggle><md-icon>menu</md-icon></button>
     <td-layout-manage-list>
       <md-toolbar td-sidenav-content>TITLE</md-toolbar>
       <md-nav-list td-sidenav-content>SIDENAV</md-nav-list>
       <td-layout-nav>
         <button md-icon-button td-menu-button tdLayoutManageListToggle><md-icon>arrow_back</md-icon></button>
         // content

Test Steps

General Tests for Every PR

  • ng serve --aot still works.
  • npm run lint passes.
  • npm test passes and code coverage is not lower.
  • npm run build still works.
Screenshots or link to CodePen/Plunker/JSfiddle

to allow more flexibility using `td-layout`, `td-layout-nav-list` and `td-layout-manage-list` we removed the toggle button from the component and created a few toggle directives so developers can pick and choose how and when to add them
before we needed to check if `td-layout-nav` was a child component of any `td-layout` wrapper. now we will remove that dependency all together and the menu button in favor of a `[td-menu-button]` placeholder so users can add their own button and add `[tdLayoutToggle]` or their own sidenav.
@emoralesb05 emoralesb05 added this to the RC 1 milestone Jun 9, 2017
@emoralesb05 emoralesb05 merged commit 8881dc8 into develop Jul 4, 2017
@emoralesb05 emoralesb05 deleted the feature/layout-toggles branch July 4, 2017 05:15
@ranouf

ranouf commented Dec 17, 2019

Copy link
Copy Markdown

Hi,

is it possible to have something like "hideWhenClosed"? or a way to get the current status (true = opened, false = close)?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants