From 306aac76aee4639b965185c9ef3b38d608f24b4f Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 28 May 2019 13:25:48 +0200 Subject: [PATCH 01/24] add sub navigation STAR-620 --- src/components/navigation.tsx | 221 ++++---------------- src/components/navigation_desktop.tsx | 69 ++++++ src/components/navigation_mobile.tsx | 179 ++++++++++++++++ src/components/sub_navigation_menu.tsx | 33 +++ src/components/sub_navigation_menu_item.tsx | 30 +++ src/index.tsx | 5 + src/stories/layout.stories.tsx | 18 +- src/stylesheets/_navigation.scss | 5 +- src/stylesheets/_sub_navigation_menu.scss | 25 +++ src/stylesheets/main.scss | 1 + 10 files changed, 407 insertions(+), 179 deletions(-) create mode 100644 src/components/navigation_desktop.tsx create mode 100644 src/components/navigation_mobile.tsx create mode 100644 src/components/sub_navigation_menu.tsx create mode 100644 src/components/sub_navigation_menu_item.tsx create mode 100644 src/stylesheets/_sub_navigation_menu.scss diff --git a/src/components/navigation.tsx b/src/components/navigation.tsx index 2726a62e..e4928aa8 100644 --- a/src/components/navigation.tsx +++ b/src/components/navigation.tsx @@ -1,17 +1,20 @@ import * as React from 'react'; -import { NavLink } from 'react-router-dom'; import classNames from 'classnames'; // components -import Button from './button'; -import ProfileImage from './profile_image'; -import SlideOutContainer from './slide_out_container'; -import SlideInPanel from '../components/slide_in_panel'; +import NavigationDesktop from './navigation_desktop'; +import NavigationMobile from './navigation_mobile'; + +export interface SubNavRoute { + path: string; + label: string; +} export interface NavRoute { path: string; label: string; visible: boolean; + subRoutes?: SubNavRoute[]; } export interface NavigationProps { @@ -51,177 +54,41 @@ export interface NavigationProps { showMobileAccountNav?: boolean; } -export interface NavigationState { - showAccountNav: boolean; -} - -export class Navigation extends React.Component { - state = { - showAccountNav: false, - } - - constructor(props) { - super(props); - - this._onCloseMobileMenuHandler = this._onCloseMobileMenuHandler.bind(this); - } - - private _onCloseMobileMenuHandler(): void { - const { onCloseMobileMenuHandler } = this.props; - - if (onCloseMobileMenuHandler) { - onCloseMobileMenuHandler(); - } - } - - private _toggleShowAccountNav(showAccountNav: boolean): void { - this.setState({ - showAccountNav, - }); - } - - private _renderMobileMenu(visibleNavLinks: NavRoute[]): JSX.Element { - const { - onSignOutClickHandler, onSignInClickHandler, manageAccountURL, showMobileMenu, - signedOut, accountButtonText, signOutButtonText, accountImageURL, accountDisplayName, - signInButtonText, showMobileAccountNav, - } = this.props; - const { showAccountNav } = this.state; - - return ( -
- - - -
- {showMobileAccountNav && ( -
- {signedOut && ( - - )} - {!signedOut && ( - -
- -
-
-
{accountDisplayName}
-
-
- )} - onHeaderClick={ - () => this._toggleShowAccountNav(!showAccountNav) - } - > -
    - {manageAccountURL && ( -
  • - - {accountButtonText} - -
  • - )} - - {onSignOutClickHandler && ( -
  • - -
  • - )} -
- - )} -
- )} - -
    - {visibleNavLinks.map(navLink => ( -
  • - - {navLink.label} - -
  • - ))} -
-
- - - - - ); - } - - render(): JSX.Element { - const { - navLinks, showMobileMenu, navLabel, - } = this.props; - - const navClasses = classNames('navigation', { 'navigation--open': showMobileMenu }); - const visibleNavLinks = navLinks.filter(navLink => navLink.visible); - - return ( -
- {(visibleNavLinks.length > 0 || navLabel) && ( -
- {visibleNavLinks.length > 0 && ( -
- -
- )} - - {navLabel && ( -
-
- {navLabel} -
-
- )} -
- )} - - {this._renderMobileMenu(visibleNavLinks)} -
- ); - } -} +export const Navigation: React.StatelessComponent = ({ + navLinks, navLabel, manageAccountURL, onSignOutClickHandler, + onSignInClickHandler, accountButtonText, signOutButtonText, signInButtonText, + accountDisplayName, accountImageURL, signedOut, showMobileMenu, + onCloseMobileMenuHandler, showMobileAccountNav, +}) => { + const navClasses = classNames('navigation', { 'navigation--open': showMobileMenu }); + const visibleNavLinks = navLinks.filter(navLink => navLink.visible); + + return ( +
+ {(visibleNavLinks.length > 0 || navLabel) && ( + + )} + + +
+ ); +}; export default Navigation; diff --git a/src/components/navigation_desktop.tsx b/src/components/navigation_desktop.tsx new file mode 100644 index 00000000..4cfbf694 --- /dev/null +++ b/src/components/navigation_desktop.tsx @@ -0,0 +1,69 @@ +import * as React from 'react'; +import { NavLink, withRouter, RouteComponentProps } from 'react-router-dom'; + +// components +import SubNavigationMenu from './sub_navigation_menu'; +import SubNavigationMenuItem from './sub_navigation_menu_item'; +import { NavRoute } from './Navigation'; + +export interface NavigationDesktopProps extends RouteComponentProps<{}> { + /** Details for the visible nav items */ + visibleNavLinks: NavRoute[]; + /** A label to be shown in the navigation bar */ + navLabel?: string; +} + + +export const NavigationDesktop: React.StatelessComponent = ({ + navLabel, visibleNavLinks, location, +}) => ( +
+ {visibleNavLinks.length > 0 && ( +
+ +
+ )} + + {navLabel && ( +
+
+ {navLabel} +
+
+ )} +
+); + +NavigationDesktop.displayName = 'NavigationDesktop'; + +export default withRouter(NavigationDesktop); diff --git a/src/components/navigation_mobile.tsx b/src/components/navigation_mobile.tsx new file mode 100644 index 00000000..56c2d89f --- /dev/null +++ b/src/components/navigation_mobile.tsx @@ -0,0 +1,179 @@ +import * as React from 'react'; +import { NavLink } from 'react-router-dom'; + +// components +import Button from './button'; +import ProfileImage from './profile_image'; +import SlideOutContainer from './slide_out_container'; +import SlideInPanel from '../components/slide_in_panel'; + +// components +import { NavRoute } from './Navigation'; + +export interface NavigationMobileProps { + /** Details for the visible nav items */ + visibleNavLinks: NavRoute[]; + /** URL for the account portal */ + manageAccountURL?: string; + /** Called when sign out is clicked */ + onSignOutClickHandler?: () => void; + /** Called when the sign in button is clicked */ + onSignInClickHandler?: () => void; + /** The label for account navigation on mobile */ + accountButtonText?: string; + /** The label for sign out on mobile */ + signOutButtonText?: string; + /** The label for sign in */ + signInButtonText?: string; + /** The username of the user to be shown in the mobile menu */ + accountDisplayName?: string; + /** The URL to the user's account page */ + accountImageURL?: string; + /** Whether the user is signed out */ + signedOut?: boolean; + /** + * Used to toggle the visibility of the mobile navigation menu. + * Passed in by the header component. + */ + showMobileMenu?: boolean; + /** + * Called when the mobile navigation is closed. + * Passed in by the header component. + */ + onCloseMobileMenuHandler?: () => void; + /** Whether the user profile should be displayed in the mobile menu */ + showMobileAccountNav?: boolean; +} + +export interface NavigationMobileState { + showAccountNav: boolean; +} + +export class NavigationMobile extends + React.Component { + state = { + showAccountNav: false, + } + + constructor(props) { + super(props); + + this._onCloseMobileMenuHandler = this._onCloseMobileMenuHandler.bind(this); + } + + private _onCloseMobileMenuHandler(): void { + const { onCloseMobileMenuHandler } = this.props; + + if (onCloseMobileMenuHandler) { + onCloseMobileMenuHandler(); + } + } + + private _toggleShowAccountNav(showAccountNav: boolean): void { + this.setState({ + showAccountNav, + }); + } + + render(): JSX.Element { + const { + onSignOutClickHandler, onSignInClickHandler, manageAccountURL, showMobileMenu, + signedOut, accountButtonText, signOutButtonText, accountImageURL, accountDisplayName, + signInButtonText, showMobileAccountNav, visibleNavLinks, + } = this.props; + const { showAccountNav } = this.state; + + return ( +
+ +
+ {showMobileAccountNav && ( +
+ {signedOut && ( + + )} + {!signedOut && ( + +
+ +
+
+
{accountDisplayName}
+
+
+ )} + onHeaderClick={ + () => this._toggleShowAccountNav(!showAccountNav) + } + > +
    + {manageAccountURL && ( +
  • + + {accountButtonText} + +
  • + )} + + {onSignOutClickHandler && ( +
  • + +
  • + )} +
+ + )} +
+ )} +
    + {visibleNavLinks.map(navLink => ( +
  • + + {navLink.label} + + {navLink.subRoutes && navLink.subRoutes.map(subNavItem => ( + + {subNavItem.label} + + ))} +
  • + + ))} +
+
+ + + ); + } +} + +export default NavigationMobile; diff --git a/src/components/sub_navigation_menu.tsx b/src/components/sub_navigation_menu.tsx new file mode 100644 index 00000000..c12ade0a --- /dev/null +++ b/src/components/sub_navigation_menu.tsx @@ -0,0 +1,33 @@ +import * as React from 'react'; +import classNames from 'classnames'; + +// components +import DropDownMenu from './drop_down_menu'; + +export interface SubNavigationMenuProps { + menuLabel: string; + active: boolean; + children: JSX.Element | JSX.Element[]; +} + +/** + * Component that displays information about a product + */ +export const SubNavigationMenu: React.StatelessComponent = ({ + menuLabel, active, children, +}) => { + const navClasses = classNames('sub-navigation-menu', { 'sub-navigation-menu--active': active }); + + return ( +
+ + {children} + +
+ + ); +}; + +SubNavigationMenu.displayName = 'SubNavigationMenu'; + +export default SubNavigationMenu; diff --git a/src/components/sub_navigation_menu_item.tsx b/src/components/sub_navigation_menu_item.tsx new file mode 100644 index 00000000..7fe9c88f --- /dev/null +++ b/src/components/sub_navigation_menu_item.tsx @@ -0,0 +1,30 @@ +import * as React from 'react'; + +import { NavLink } from 'react-router-dom'; + +export interface SubNavigationMenuItemProps { + path: string; + label: string; + /** Passed by the DropDownMenu component */ + onCloseMenuHandler?: () => void; +} + +/** + * Component that displays information about a product + */ +export const SubNavigationMenuItem: React.StatelessComponent = ({ + path, label, onCloseMenuHandler, +}) => ( + +
{label}
+
+); + +SubNavigationMenuItem.displayName = 'SubNavigationMenuItem'; + +export default SubNavigationMenuItem; diff --git a/src/index.tsx b/src/index.tsx index 12ae891b..2cd2bc9c 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -37,6 +37,9 @@ export * from './components/loading'; export * from './components/modal'; export * from './components/more_pill'; export * from './components/navigation'; +export * from './components/navigation_desktop'; +export * from './components/navigation_mobile'; +export * from './components/navigation'; export * from './components/navigation_old'; export * from './components/page_section'; export * from './components/page_title'; @@ -60,6 +63,8 @@ export * from './components/setting_panel'; export * from './components/slide_in_panel'; export * from './components/slide_out_container'; export * from './components/spinner'; +export * from './components/sub_navigation_menu'; +export * from './components/sub_navigation_menu_item'; export * from './components/sub_resource_item'; export * from './components/sub_resource_list'; export * from './components/tags_selector'; diff --git a/src/stories/layout.stories.tsx b/src/stories/layout.stories.tsx index c4aa017f..4681d2a7 100644 --- a/src/stories/layout.stories.tsx +++ b/src/stories/layout.stories.tsx @@ -23,7 +23,7 @@ import SettingPanel from '../components/setting_panel'; import Carousel from '../components/carousel'; import AspectRatioContainer from '../components/aspect_ratio_container'; import Header from '../components/header'; -import Navigation from '../components/navigation'; +import Navigation, { NavRoute } from '../components/navigation'; import HeaderOld from '../components/header_old'; import NavigationOld from '../components/navigation_old'; import UserAccountMenu from '../components/user_account_menu'; @@ -160,6 +160,22 @@ const routes = [{ component: null, visible: true, }, +{ + path: '/manage', + label: 'Manage', + component: null, + visible: true, + subRoutes: [ + { + path: '/manage/teams', + label: 'Teams', + }, + { + path: '/manage/printers', + label: 'Printers', + }, + ], +}, { path: '/settings', label: 'Settings', diff --git a/src/stylesheets/_navigation.scss b/src/stylesheets/_navigation.scss index dcf8a60b..b314f095 100644 --- a/src/stylesheets/_navigation.scss +++ b/src/stylesheets/_navigation.scss @@ -28,7 +28,6 @@ border: none; li { - flex: 1 1 0; margin: 0; } } @@ -111,3 +110,7 @@ display: block; width: 80%; } + +.mobile-sub-navigation-menu-item { + margin-left: 2.4rem; +} diff --git a/src/stylesheets/_sub_navigation_menu.scss b/src/stylesheets/_sub_navigation_menu.scss new file mode 100644 index 00000000..637d4ec8 --- /dev/null +++ b/src/stylesheets/_sub_navigation_menu.scss @@ -0,0 +1,25 @@ +.sub-navigation-menu { + .drop-down-menu .drop-down-menu-base__menu { + min-width: 100%; + } + .drop-down-menu .drop-down-menu-base__trigger { + border-bottom: 0.3rem solid transparent; + padding: 0 1.8rem 0 2.4rem; + height: 4.8rem; + + &:hover, &:focus { + background-color: transparent; + border-bottom-color: rgba(0, 0, 0, 0.06); + } + } +} + +.sub-navigation-menu--active { + .drop-down-menu .drop-down-menu-base__trigger { + border-bottom-color: $color-border-active; + + &:hover, &:focus { + border-bottom-color: $color-border-active; + } + } +} diff --git a/src/stylesheets/main.scss b/src/stylesheets/main.scss index 718f9366..832c5259 100644 --- a/src/stylesheets/main.scss +++ b/src/stylesheets/main.scss @@ -58,6 +58,7 @@ @import "sub_resource_list"; @import "sub_resource_item"; @import "app_switcher_menu"; +@import "sub_navigation_menu"; @import "header_old"; @import "navigation_old"; From 68afe4a9856c76d1dbc80737cd47d9ea440ecc10 Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 28 May 2019 14:40:11 +0200 Subject: [PATCH 02/24] make hovering menu items clearer --- src/stylesheets/_navigation.scss | 3 ++- src/stylesheets/_sub_navigation_menu.scss | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/stylesheets/_navigation.scss b/src/stylesheets/_navigation.scss index b314f095..b3c09334 100644 --- a/src/stylesheets/_navigation.scss +++ b/src/stylesheets/_navigation.scss @@ -43,11 +43,12 @@ justify-content: center; text-align: center; border-bottom: 3px solid transparent; + transition: all 0.2s ease-out; @include font-size-text-1; &:hover, &:focus { - border-bottom-color: $color-background-darker; + color: $color-blue; text-decoration: none; } diff --git a/src/stylesheets/_sub_navigation_menu.scss b/src/stylesheets/_sub_navigation_menu.scss index 637d4ec8..f85abb4a 100644 --- a/src/stylesheets/_sub_navigation_menu.scss +++ b/src/stylesheets/_sub_navigation_menu.scss @@ -6,10 +6,11 @@ border-bottom: 0.3rem solid transparent; padding: 0 1.8rem 0 2.4rem; height: 4.8rem; + transition: all 0.2s ease-out; &:hover, &:focus { background-color: transparent; - border-bottom-color: rgba(0, 0, 0, 0.06); + color: $color-blue; } } } From f515c5fbdd5273b0c43c0f9537490d0a3e968b35 Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 28 May 2019 16:15:29 +0200 Subject: [PATCH 03/24] align menu to the left --- src/stylesheets/_sub_navigation_menu.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/src/stylesheets/_sub_navigation_menu.scss b/src/stylesheets/_sub_navigation_menu.scss index f85abb4a..9492e15a 100644 --- a/src/stylesheets/_sub_navigation_menu.scss +++ b/src/stylesheets/_sub_navigation_menu.scss @@ -1,6 +1,7 @@ .sub-navigation-menu { .drop-down-menu .drop-down-menu-base__menu { min-width: 100%; + right: auto; } .drop-down-menu .drop-down-menu-base__trigger { border-bottom: 0.3rem solid transparent; From 06d97d483f71d463a553015deebda9c5164e604d Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 28 May 2019 17:26:21 +0200 Subject: [PATCH 04/24] make mobile sub navigation an accordion --- src/components/navigation_mobile.tsx | 199 +++++++++--------- src/components/sub_navigation_mobile_menu.tsx | 47 +++++ src/stylesheets/_navigation.scss | 15 +- src/stylesheets/_sub_navigation_menu.scss | 1 + .../_sub_navigation_mobile_menu.scss | 17 ++ src/stylesheets/main.scss | 1 + 6 files changed, 173 insertions(+), 107 deletions(-) create mode 100644 src/components/sub_navigation_mobile_menu.tsx create mode 100644 src/stylesheets/_sub_navigation_mobile_menu.scss diff --git a/src/components/navigation_mobile.tsx b/src/components/navigation_mobile.tsx index 56c2d89f..47bbe101 100644 --- a/src/components/navigation_mobile.tsx +++ b/src/components/navigation_mobile.tsx @@ -5,7 +5,8 @@ import { NavLink } from 'react-router-dom'; import Button from './button'; import ProfileImage from './profile_image'; import SlideOutContainer from './slide_out_container'; -import SlideInPanel from '../components/slide_in_panel'; +import SlideInPanel from './slide_in_panel'; +import SubNavigationMobileMenu from './sub_navigation_mobile_menu'; // components import { NavRoute } from './Navigation'; @@ -45,16 +46,7 @@ export interface NavigationMobileProps { showMobileAccountNav?: boolean; } -export interface NavigationMobileState { - showAccountNav: boolean; -} - -export class NavigationMobile extends - React.Component { - state = { - showAccountNav: false, - } - +export class NavigationMobile extends React.Component { constructor(props) { super(props); @@ -69,19 +61,106 @@ export class NavigationMobile extends } } - private _toggleShowAccountNav(showAccountNav: boolean): void { - this.setState({ - showAccountNav, - }); - } - - render(): JSX.Element { + private _renderAccountNav(): JSX.Element { const { - onSignOutClickHandler, onSignInClickHandler, manageAccountURL, showMobileMenu, + onSignOutClickHandler, onSignInClickHandler, manageAccountURL, signInButtonText, signedOut, accountButtonText, signOutButtonText, accountImageURL, accountDisplayName, - signInButtonText, showMobileAccountNav, visibleNavLinks, } = this.props; - const { showAccountNav } = this.state; + + return ( +
+ {signedOut && ( + + )} + {!signedOut && ( + +
+ +
+
+
{accountDisplayName}
+
+
+ )} + > +
    + {manageAccountURL && ( +
  • + + {accountButtonText} + +
  • + )} + + {onSignOutClickHandler && ( +
  • + +
  • + )} +
+ + )} + + ); + } + + private _renderNavLinks(): JSX.Element { + const { visibleNavLinks } = this.props; + + return ( +
    + {visibleNavLinks.map(navLink => ( +
  • + {!navLink.subRoutes && ( + + {navLink.label} + + )} + {navLink.subRoutes && ( + +
      + {navLink.subRoutes && navLink.subRoutes.map(subNavItem => ( +
    • + + {subNavItem.label} + +
    • + ))} +
    +
    + )} +
  • + + ))} +
+ ); + } + + render(): JSX.Element { + const { showMobileMenu, showMobileAccountNav } = this.props; return (
@@ -93,82 +172,8 @@ export class NavigationMobile extends slideDirection="left" >
- {showMobileAccountNav && ( -
- {signedOut && ( - - )} - {!signedOut && ( - -
- -
-
-
{accountDisplayName}
-
-
- )} - onHeaderClick={ - () => this._toggleShowAccountNav(!showAccountNav) - } - > -
    - {manageAccountURL && ( -
  • - - {accountButtonText} - -
  • - )} - - {onSignOutClickHandler && ( -
  • - -
  • - )} -
- - )} -
- )} -
    - {visibleNavLinks.map(navLink => ( -
  • - - {navLink.label} - - {navLink.subRoutes && navLink.subRoutes.map(subNavItem => ( - - {subNavItem.label} - - ))} -
  • - - ))} -
+ {showMobileAccountNav && this._renderAccountNav()} + {this._renderNavLinks()}
diff --git a/src/components/sub_navigation_mobile_menu.tsx b/src/components/sub_navigation_mobile_menu.tsx new file mode 100644 index 00000000..ce2cf7c7 --- /dev/null +++ b/src/components/sub_navigation_mobile_menu.tsx @@ -0,0 +1,47 @@ +import * as React from 'react'; + +// components +import SlideOutContainer from './slide_out_container'; + +export interface SubNavigationMobileMenuProps { + menuLabel: string | JSX.Element | JSX.Element[]; +} + +export interface SubNavigationMobileMenuState { + isOpen: boolean; +} + +export class SubNavigationMobileMenu extends + React.Component { + state = { + isOpen: false, + } + + private _toggleShowAccountNav(isOpen: boolean): void { + this.setState({ + isOpen, + }); + } + + render(): JSX.Element { + const { menuLabel, children } = this.props; + const { isOpen } = this.state; + + return ( +
+ this._toggleShowAccountNav(!isOpen) + } + > + {children} + +
+ ); + } +} + +export default SubNavigationMobileMenu; diff --git a/src/stylesheets/_navigation.scss b/src/stylesheets/_navigation.scss index b3c09334..e6bbe9a6 100644 --- a/src/stylesheets/_navigation.scss +++ b/src/stylesheets/_navigation.scss @@ -75,7 +75,7 @@ } .drop-down-menu-base__item { - padding: 1.2rem 3.6rem; + padding: 1.2rem 2.4rem; &.active .label { border-bottom: 2px solid $color-border-active; @@ -91,21 +91,16 @@ border-bottom: 1px solid $color-border-light; margin-bottom: 1.2rem; - .slide-out-container__header { - padding: 2.4rem 1.8rem; + .sub-navigation-mobile-menu .slide-out-container__header { + padding: 2.4rem 2.4rem 2.4rem 1.8rem; font-family: $font-primary; } - .slide-out-container__body { - padding: 0; + .sub-navigation-mobile-menu__options { + border-bottom: none; } } -.navigation__account-options { - background: $color-grey-lightest; - border-top: 1px solid $color-border-light; -} - .navigation__account-sign-in-btn { margin: 2.4rem auto; display: block; diff --git a/src/stylesheets/_sub_navigation_menu.scss b/src/stylesheets/_sub_navigation_menu.scss index 9492e15a..95651bf7 100644 --- a/src/stylesheets/_sub_navigation_menu.scss +++ b/src/stylesheets/_sub_navigation_menu.scss @@ -8,6 +8,7 @@ padding: 0 1.8rem 0 2.4rem; height: 4.8rem; transition: all 0.2s ease-out; + @include font-size-text-1; &:hover, &:focus { background-color: transparent; diff --git a/src/stylesheets/_sub_navigation_mobile_menu.scss b/src/stylesheets/_sub_navigation_mobile_menu.scss new file mode 100644 index 00000000..fbcc8e42 --- /dev/null +++ b/src/stylesheets/_sub_navigation_mobile_menu.scss @@ -0,0 +1,17 @@ +.sub-navigation-mobile-menu { + .slide-out-container__header { + font-size: 1.4rem; + padding: 1.2rem 2.4rem; + font-family: $font-primary; + } + + .slide-out-container__body { + padding: 0; + } +} + +.sub-navigation-mobile-menu__options { + background: $color-grey-lightest; + border-top: 1px solid $color-border-light; + border-bottom: 1px solid $color-border-light; +} diff --git a/src/stylesheets/main.scss b/src/stylesheets/main.scss index 832c5259..033e84bd 100644 --- a/src/stylesheets/main.scss +++ b/src/stylesheets/main.scss @@ -59,6 +59,7 @@ @import "sub_resource_item"; @import "app_switcher_menu"; @import "sub_navigation_menu"; +@import "sub_navigation_mobile_menu"; @import "header_old"; @import "navigation_old"; From ddd4967753b65b28851003d3d922b804f803aae8 Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 28 May 2019 17:58:59 +0200 Subject: [PATCH 05/24] improve spacing --- src/stylesheets/_navigation.scss | 11 +++-------- src/stylesheets/_sub_navigation_mobile_menu.scss | 5 +++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/stylesheets/_navigation.scss b/src/stylesheets/_navigation.scss index e6bbe9a6..7f48260a 100644 --- a/src/stylesheets/_navigation.scss +++ b/src/stylesheets/_navigation.scss @@ -75,10 +75,10 @@ } .drop-down-menu-base__item { - padding: 1.2rem 2.4rem; + padding: 1.8rem 2.4rem; &.active .label { - border-bottom: 2px solid $color-border-active; + color: $color-blue; } &:hover, &:focus { @@ -89,10 +89,9 @@ .navigation__account { border-bottom: 1px solid $color-border-light; - margin-bottom: 1.2rem; .sub-navigation-mobile-menu .slide-out-container__header { - padding: 2.4rem 2.4rem 2.4rem 1.8rem; + padding: 2.4rem; font-family: $font-primary; } @@ -106,7 +105,3 @@ display: block; width: 80%; } - -.mobile-sub-navigation-menu-item { - margin-left: 2.4rem; -} diff --git a/src/stylesheets/_sub_navigation_mobile_menu.scss b/src/stylesheets/_sub_navigation_mobile_menu.scss index fbcc8e42..a52866a5 100644 --- a/src/stylesheets/_sub_navigation_mobile_menu.scss +++ b/src/stylesheets/_sub_navigation_mobile_menu.scss @@ -1,7 +1,7 @@ .sub-navigation-mobile-menu { .slide-out-container__header { font-size: 1.4rem; - padding: 1.2rem 2.4rem; + padding: 1.8rem 2.4rem; font-family: $font-primary; } @@ -10,7 +10,8 @@ } } -.sub-navigation-mobile-menu__options { +.sub-navigation-mobile-menu__options{ + padding: 0.6rem 0; background: $color-grey-lightest; border-top: 1px solid $color-border-light; border-bottom: 1px solid $color-border-light; From abc43007460e4b7ab95f409e97cc9fda27055188 Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 3 Jun 2019 09:29:54 +0200 Subject: [PATCH 06/24] add mising key --- src/components/navigation_mobile.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/navigation_mobile.tsx b/src/components/navigation_mobile.tsx index 47bbe101..5610f677 100644 --- a/src/components/navigation_mobile.tsx +++ b/src/components/navigation_mobile.tsx @@ -137,7 +137,7 @@ export class NavigationMobile extends React.Component >
    {navLink.subRoutes && navLink.subRoutes.map(subNavItem => ( -
  • +
  • Date: Mon, 3 Jun 2019 09:59:28 +0200 Subject: [PATCH 07/24] fix loading page position --- src/stylesheets/_loading.scss | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/stylesheets/_loading.scss b/src/stylesheets/_loading.scss index 3b1d799f..d284b6cc 100644 --- a/src/stylesheets/_loading.scss +++ b/src/stylesheets/_loading.scss @@ -20,8 +20,11 @@ } .loading-page { - height: 100vh; - width: 100vw; + position: absolute; + top: 0; + bottom: 0; + right: 0; + left: 0; display: flex; justify-content: center; align-items: center; From 7b40ad9ad7a92a569e8f735a61f2a38b31f56f52 Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 3 Jun 2019 10:01:21 +0200 Subject: [PATCH 08/24] don't show subRoutes if list is empty --- src/components/navigation_desktop.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/navigation_desktop.tsx b/src/components/navigation_desktop.tsx index 4cfbf694..6e862179 100644 --- a/src/components/navigation_desktop.tsx +++ b/src/components/navigation_desktop.tsx @@ -24,7 +24,7 @@ export const NavigationDesktop: React.StatelessComponent
      {visibleNavLinks.map(navLink => (
    • - {!navLink.subRoutes && ( + {(!navLink.subRoutes || navLink.subRoutes.length === 0) && ( {navLink.label} )} - {navLink.subRoutes && ( + {navLink.subRoutes && navLink.subRoutes.length > 0 && ( Date: Mon, 3 Jun 2019 10:09:45 +0200 Subject: [PATCH 09/24] update snapshots --- .../__snapshots__/navigation.test.tsx.snap | 713 +++++++----------- src/components/navigation.tsx | 2 + 2 files changed, 255 insertions(+), 460 deletions(-) diff --git a/src/components/__tests__/__snapshots__/navigation.test.tsx.snap b/src/components/__tests__/__snapshots__/navigation.test.tsx.snap index 08ac372d..e669a9e0 100644 --- a/src/components/__tests__/__snapshots__/navigation.test.tsx.snap +++ b/src/components/__tests__/__snapshots__/navigation.test.tsx.snap @@ -4,57 +4,13 @@ exports[`The Navigation component should not render desktop navigation if no vis
      -
      - -
      -
      - -
      - -
      -
      -
      -
      -
      - } - headerTextAlignment="left" - isOpen={false} - onHeaderClick={[Function]} - panelArrowWidth="1.2rem" - showHeaderPanelArrow={true} - > -
        - -
      -
        -
      -
      -
      +
      `; @@ -62,109 +18,32 @@ exports[`The Navigation component should render 1`] = `
      -
      -
      - -
      -
      -
      - -
      -
      - -
      - -
      -
      -
      -
      -
      - } - headerTextAlignment="left" - isOpen={false} - onHeaderClick={[Function]} - panelArrowWidth="1.2rem" - showHeaderPanelArrow={true} - > -
        - -
      -
        -
      • - - - Home - - -
      • -
      -
      -
      -
      + +
      `; @@ -222,120 +101,124 @@ exports[`The Navigation component should render manage account button 1`] = ` class="navigation__account" >
      -
      - - -
      + +
      - + + Account + + +
    • +
    + @@ -418,124 +301,128 @@ exports[`The Navigation component should render sign out button 1`] = ` class="navigation__account" >
    -
    - - -
    + +
    - + +
  • +
+ @@ -568,85 +455,33 @@ exports[`The Navigation component should render when signed out 1`] = `
-
-
- -
-
-
- -
-
-
-
    -
  • - - - Home - - -
  • -
-
-
-
+ +
`; @@ -654,73 +489,31 @@ exports[`The Navigation component should render without mobile account navigatio
-
-
- -
-
-
- -
-
    -
  • - - - Home - - -
  • -
-
-
-
+ +
`; diff --git a/src/components/navigation.tsx b/src/components/navigation.tsx index e4928aa8..5c1af2ed 100644 --- a/src/components/navigation.tsx +++ b/src/components/navigation.tsx @@ -91,4 +91,6 @@ export const Navigation: React.StatelessComponent = ({ ); }; +Navigation.displayName = 'Navigation'; + export default Navigation; From fb6d3043def9a24e4be228e6ac96c71df3f643b6 Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 3 Jun 2019 10:12:48 +0200 Subject: [PATCH 10/24] remove padding to align with logo --- src/stylesheets/_navigation.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/src/stylesheets/_navigation.scss b/src/stylesheets/_navigation.scss index 7f48260a..b554b1b8 100644 --- a/src/stylesheets/_navigation.scss +++ b/src/stylesheets/_navigation.scss @@ -1,7 +1,6 @@ .navigation__desktop { background-color: $color-background; position: relative; - padding: 0 2.4rem; border-bottom: 1px solid $color-border-light; .navigation__container { From 0bc1b2379ca46fcebe22b257c516ff1584708ddd Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 3 Jun 2019 10:27:30 +0200 Subject: [PATCH 11/24] fix navigation tests --- .../__snapshots__/navigation.test.tsx.snap | 34 +++++++++++++++++++ src/components/__tests__/navigation.test.tsx | 33 +----------------- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/src/components/__tests__/__snapshots__/navigation.test.tsx.snap b/src/components/__tests__/__snapshots__/navigation.test.tsx.snap index e669a9e0..12aba324 100644 --- a/src/components/__tests__/__snapshots__/navigation.test.tsx.snap +++ b/src/components/__tests__/__snapshots__/navigation.test.tsx.snap @@ -247,6 +247,40 @@ exports[`The Navigation component should render manage account button 1`] = ` `; +exports[`The Navigation component should render navigation label 1`] = ` +
+ + +
+`; + exports[`The Navigation component should render sign out button 1`] = ` `; -exports[`The Navigation component should render manage account button 1`] = ` -