From 3db052e9d2308050f34ffc7c0c9dece2e79621ae Mon Sep 17 00:00:00 2001 From: David Zearing Date: Thu, 28 Jul 2016 15:19:49 -0700 Subject: [PATCH 1/2] Applying an undo of the recent Nav changes until we sort out the correct fix. --- src/components/Nav/Nav.Props.ts | 10 --- src/components/Nav/Nav.scss | 80 +++++-------------- src/components/Nav/Nav.tsx | 64 +++++---------- .../NavPage/examples/Nav.Basic.Example.tsx | 11 +-- 4 files changed, 42 insertions(+), 123 deletions(-) diff --git a/src/components/Nav/Nav.Props.ts b/src/components/Nav/Nav.Props.ts index 7da3d365c8d152..33febb0c728c10 100644 --- a/src/components/Nav/Nav.Props.ts +++ b/src/components/Nav/Nav.Props.ts @@ -21,16 +21,6 @@ export interface INavProps { * Indicates whether the navigation component renders on top of other content in the UI */ isOnTop?: boolean; - - /** - * (Optional) The alt text for the expanded state - **/ - expandedStateText?: string; - - /** - * (Optional) The alt text for the collapsed state text - **/ - collapsedStateText?: string; } export interface INavLinkGroup { diff --git a/src/components/Nav/Nav.scss b/src/components/Nav/Nav.scss index 4a5305615959fa..f97675faa021fe 100644 --- a/src/components/Nav/Nav.scss +++ b/src/components/Nav/Nav.scss @@ -39,52 +39,25 @@ transition: transform .1s linear; } -.ms-Nav-links { - display: block; - position: relative; - - .ms-Nav-chevronButton.ms-Nav-chevronButton--link { - display: block; - width: 40px; - height: 40px; - position: absolute; - top: 0; - @include left(0); - z-index: 1; - padding: 0; - margin: 0; - - .ms-Nav-chevron { - position: relative; - } - - &:hover { - background: transparent; - color: $ms-color-themePrimary; - } - } - - &.is-expanded { - .ms-Nav-chevron { - transform: rotate(-180deg); - } - } +.ms-Nav-IconLink { + @include margin-right(4px); } -.ms-Nav-chevronButton { +.ms-Nav-groupButton { display: block; + width: 100%; + height: 40px; + font-family: $ms-font-family-regular; font-size: $ms-font-size-s; @include text-align(left); line-height: 40px; margin: 5px 0; - padding-top: 0px; - @include padding-right(40px); - padding-bottom: 0px; - @include padding-left(40px); + padding: 0 40px; background: none; border: none; + border-bottom: 1px solid $dividerColor; text-transform: uppercase; cursor: pointer; @@ -99,15 +72,9 @@ color: $unselectedHoverForegroundColor; background: $unselectedHoverBackgroundColor; } - - &.ms-Nav-chevronButton--group { - width: 100%; - height: 40px; - border-bottom: 1px solid $dividerColor; - } } -.ms-Nav-chevron.ms-Icon { +.ms-Nav-groupChevron.ms-Icon { position: absolute; @include left(15px); height: 40px; @@ -116,25 +83,22 @@ transition: transform .1s linear; } -.ms-Nav-group.is-expanded .ms-Nav-chevronButton--group .ms-Nav-chevron { +.ms-Nav-group.is-expanded .ms-Nav-groupChevron { transform: rotate(-180deg); } -.ms-Nav-linkText { - vertical-align: middle; -} - .ms-Nav-link { display: block; position: relative; - padding-top: 10px; - @include padding-right(10px); - padding-bottom: 10px; - @include padding-left(40px); + height: 40px; + line-height: 40px; + text-decoration: none; + padding: 0 40px; cursor: pointer; - overflow: hidden; - word-wrap: break-word; + text-overflow: ellipsis; text-decoration: none; + white-space: nowrap; + overflow-x: hidden; color: $unselectedForegroundColor; background: $unselectedBackgroundColor; @@ -160,17 +124,13 @@ content: ''; position: absolute; top: 0; - @include right(0); + right: 0; bottom: 0; - @include left(0); + left: 0; } } } -.ms-Nav-chevronButton, -.ms-Nav-chevronButton--group, -.ms-Nav-chevronButton--link, -.ms-Nav-link { +.ms-Nav-groupButton, .ms-Nav-link { @include focus-border(); } - diff --git a/src/components/Nav/Nav.tsx b/src/components/Nav/Nav.tsx index a30931d8a69de1..2941e036d999bd 100644 --- a/src/components/Nav/Nav.tsx +++ b/src/components/Nav/Nav.tsx @@ -43,49 +43,31 @@ export class Nav extends React.Component { ); } - private _renderAnchorLink(link: INavLink): React.ReactElement<{}> { - return ( - { this.props.onRenderLink(link) } - ); - } - - private _renderCompositeLink(link: INavLink, linkIndex: number): React.ReactElement<{}> { - return ( -
- - { this._renderAnchorLink(link) } -
- ); - } - - private _renderLink(link: INavLink, linkIndex: number, level: number): React.ReactElement<{}> { + private _renderLink(link: INavLink, linkIndex: number): React.ReactElement<{}> { return (
  • - {(level === 0 && link.links && link.links.length > 0 ? - this._renderCompositeLink(link, linkIndex) : this._renderAnchorLink(link) - )} - { (link.isExpanded ? this._renderLinks(link.links, ++level) : null) } -
  • + + { (link.iconClassName ? + + : '') } + { this.props.onRenderLink(link)} + { this._renderLinks(link.links) } + ); } - private _renderLinks(links: INavLink[], level: number): React.ReactElement<{}> { + private _renderLinks(links: INavLink[]): React.ReactElement<{}> { if (!links || !links.length) { return null; } const linkElements: React.ReactElement<{}>[] = links.map( - (link: INavLink, linkIndex: number) => this._renderLink(link, linkIndex, level)); + (link: INavLink, linkIndex: number) => this._renderLink(link, linkIndex)); return (