Skip to content

Commit

Permalink
feat(global header): Add global actions with animations (#3008)
Browse files Browse the repository at this point in the history
* feat(global-header): componentize parts of global header and add new global actions component

* Begin docs

* Begin docs

* Add documentation and tests

* Revert export

* Update snapshots

* update snapshots

* Fix lint and tests

* Add annotations and updated tests

* Fix typos and deconstructed props

* Add rem function to px values, add copy regarding unread notifications

* Fix lint

* Change token ref to brand, update tests

* Add some documentation around notifications

* Add favorites popover and task menu

* Update snapshots

* Update menus component to take custom icon

* Lint

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Add accessibility note to new notifications
  • Loading branch information
brandonferrua committed Jan 31, 2018
1 parent 069a3c8 commit 399da9c
Show file tree
Hide file tree
Showing 45 changed files with 9,284 additions and 348 deletions.
737 changes: 737 additions & 0 deletions test/__tests__/__snapshots__/Global_Header_Action_Bar.json

Large diffs are not rendered by default.

206 changes: 206 additions & 0 deletions test/__tests__/__snapshots__/Global_Header_Favorites_Disabled.json

Large diffs are not rendered by default.

201 changes: 201 additions & 0 deletions test/__tests__/__snapshots__/Global_Header_Favorites_Not_Pressed.json

Large diffs are not rendered by default.

201 changes: 201 additions & 0 deletions test/__tests__/__snapshots__/Global_Header_Favorites_Pressed.json

Large diffs are not rendered by default.

115 changes: 115 additions & 0 deletions test/__tests__/__snapshots__/Global_Header_Help_Action.json

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions test/__tests__/__snapshots__/Global_Header_Logo.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

97 changes: 97 additions & 0 deletions test/__tests__/__snapshots__/Global_Header_Notification_Popup.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1,837 changes: 1,837 additions & 0 deletions test/__tests__/__snapshots__/Global_Header_Search_Active_State.json

Large diffs are not rendered by default.

981 changes: 981 additions & 0 deletions test/__tests__/__snapshots__/Global_Header_Search_Default_State.json

Large diffs are not rendered by default.

1,637 changes: 1,637 additions & 0 deletions test/__tests__/__snapshots__/Global_Header_Search_Expanded_State.json

Large diffs are not rendered by default.

115 changes: 115 additions & 0 deletions test/__tests__/__snapshots__/Global_Header_Setup_Action.json

Large diffs are not rendered by default.

115 changes: 115 additions & 0 deletions test/__tests__/__snapshots__/Global_Header_Task_Action.json

Large diffs are not rendered by default.

981 changes: 981 additions & 0 deletions test/__tests__/__snapshots__/base_global_header.json

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions test/__tests__/__snapshots__/global_header_container.json

Large diffs are not rendered by default.

74 changes: 74 additions & 0 deletions test/__tests__/__snapshots__/global_header_jump_links.json

Large diffs are not rendered by default.

64 changes: 64 additions & 0 deletions test/__tests__/__snapshots__/global_header_layout.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/__tests__/docs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import ReactDOM from 'react-dom/server';

import createHelpers from '../../jest.setup';

const { matchesMarkupAndStyle } = createHelpers(__dirname);
const { matchesMarkupAndStyle } = createHelpers(__dirname, 6868);
const { Docs } = require('../../.generated/docs.js');
const { beautify } = require('../../shared/utils/beautify.js');
const { renderWithBetterError } = require('../../shared/utils/render.js');
Expand Down
1 change: 1 addition & 0 deletions ui/components/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@

// Global Header
'global-header/base/index',
'global-header/global-actions/index',
'global-header/notifications/index',

// Global Navigation
Expand Down
2 changes: 1 addition & 1 deletion ui/components/branding/docs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Page from './docs/Page';
import Token, { Tokens } from './docs/Token';
import { Button } from '../buttons/base/example';
import ButtonIcon from '../button-icons/';
import { GlobalHeader } from '../global-header/base/example';
import GlobalHeader from '../global-header/';
import { ContextBar } from '../global-navigation/navigation-bar/example';
import { ContextTabBar, ContextTab, ContextTabPanel } from '../global-navigation/navigation-tab-bar/example';
import { FormElement } from '../form-element/base/example';
Expand Down
6 changes: 3 additions & 3 deletions ui/components/dynamic-menu/base/example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const accounts = [
'University of AZ Portable Generators'
];

const ListboxList = props => (
export const ListboxList = props => (
<Listbox
className="slds-dropdown_length-10"
vertical
Expand Down Expand Up @@ -55,7 +55,7 @@ const ListboxList = props => (
</Listbox>
);

const Footer = props => (
export const Footer = props => (
<ul>
<li>
<button className="slds-button slds-button_reset slds-p-vertical_xx-small slds-size_1-of-1">
Expand All @@ -80,7 +80,7 @@ const Footer = props => (
</ul>
);

const DynamicMenu = props => (
export const DynamicMenu = props => (
<Popover
className="slds-nubbin_top-left slds-dynamic-menu"
bodyClassName="slds-p-horizontal_none"
Expand Down
14 changes: 11 additions & 3 deletions ui/components/global-header/__tests__/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@

import React from 'react';
import createHelpers from '../../../../jest.setup';
import { GlobalHeader } from '../base/example';
import { GlobalHeaderDeprecated } from '../base/example';
import GlobalHeader from '../';

const { matchesMarkupAndStyle } = createHelpers(__dirname, 5555);
const { matchesMarkupAndStyle } = createHelpers(__dirname, 8888);

it('renders a global header', () => matchesMarkupAndStyle(<GlobalHeader />));
describe('render global header', () => {
it('renders the deprecated global header', () => {
matchesMarkupAndStyle(<GlobalHeaderDeprecated />);
});
it('render the global header', () => {
matchesMarkupAndStyle(<GlobalHeader />);
});
});
227 changes: 116 additions & 111 deletions ui/components/global-header/base/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -82,146 +82,151 @@
background-repeat: no-repeat;
background-position: left center;
}
}

/**
* Button icons on the global header
*
* @selector .slds-global-header__button_icon
* @restrict .slds-global-header__item button
* @required
*/
&__button_icon,
&__button--icon {
margin: 0 $spacing-xx-small;
color: $brand-header-icon;
@include deprecate("4.0","Use the new global actions component") {

.slds-icon {
fill: $brand-header-icon; // backwards compatible for old implementations
}
.slds-global-header {
/**
* Button icons on the global header
*
* @selector .slds-global-header__button_icon
* @restrict .slds-global-header__item button
* @deprecated
*/
&__button_icon,
&__button--icon {
margin: 0 $spacing-xx-small;
color: $brand-header-icon;

.slds-icon {
fill: $brand-header-icon; // backwards compatible for old implementations
}

&:hover:not(:disabled),
&:focus {
color: $brand-header-icon-active;
}
&:hover:not(:disabled),
&:focus {
color: $brand-header-icon-active;
}

&:hover:not(:disabled) .slds-icon,
&:focus .slds-icon {
fill: $brand-header-icon-active; // backwards compatible for old implementations
&:hover:not(:disabled) .slds-icon,
&:focus .slds-icon {
fill: $brand-header-icon-active; // backwards compatible for old implementations
}
}
}

/**
* Button icon specifically for global actions
*
* @selector .slds-global-header__button_icon-actions
* @restrict .slds-global-header__item button
* @required
*/
&__button_icon-actions,
&__button--icon-actions {
background: $brand-header-icon;
border-radius: $border-radius-medium;
color: $brand-header;

&:hover,
&:focus {
background-color: $brand-header-icon-active;
/**
* Button icon specifically for global actions
*
* @selector .slds-global-header__button_icon-actions
* @restrict .slds-global-header__item button
* @deprecated
*/
&__button_icon-actions,
&__button--icon-actions {
background: $brand-header-icon;
border-radius: $border-radius-medium;
color: $brand-header;
}

.slds-button__icon {
@include square(1rem);
}
}

/**
* Button icon specifically for global actions
*
* @selector .slds-global-header__button_icon-favorites
* @restrict .slds-global-header__item button
* @required
*/
&__button_icon-favorites,
&__button--icon-favorites {
color: $color-text-icon-inverse;

.slds-icon,
.slds-button__icon {
color: $brand-header;
stroke: $brand-header-icon;
stroke-width: $border-stroke-width-thick;
stroke-linejoin: round;
stroke-linecap: round;
}
&:hover,
&:focus {
background-color: $brand-header-icon-active;
color: $brand-header;
}

&:hover .slds-icon,
&:hover .slds-button__icon,
&:focus .slds-icon,
&:focus .slds-button__icon {
color: $brand-header;
stroke: $brand-header-icon-active;
.slds-button__icon {
@include square(1rem);
}
}

/**
* Selected state for favorites button
*
* @selector .slds-is-selected
* @restrict .slds-global-header__button_icon-favorites
* @modifier
* @group stateful
*/
&.slds-is-selected {
* Button icon specifically for global actions
*
* @selector .slds-global-header__button_icon-favorites
* @restrict .slds-global-header__item button
* @deprecated
*/
&__button_icon-favorites,
&__button--icon-favorites {
color: $color-text-icon-inverse;

.slds-icon,
.slds-button__icon {
color: $brand-header;
stroke: $brand-accessible;
stroke-width: $border-stroke-width-thin;
fill: $brand-header;
stroke: $brand-header-icon;
stroke-width: $border-stroke-width-thick;
stroke-linejoin: round;
stroke-linecap: round;
}

&:hover .slds-icon,
&:hover .slds-button__icon,
&:focus .slds-icon,
&:focus .slds-button__icon {
color: $brand-header;
stroke: $brand-accessible-active;
fill: $brand-header;
stroke: $brand-header-icon-active;
}

&:active .slds-icon,
&:active .slds-button__icon {
color: $brand-header;
stroke: $brand-accessible-active;
fill: $brand-header;
/**
* Selected state for favorites button
*
* @selector .slds-is-selected
* @restrict .slds-global-header__button_icon-favorites
* @deprecated
* @group stateful
*/
&.slds-is-selected {

.slds-icon,
.slds-button__icon {
color: $brand-header;
stroke: $brand-accessible;
stroke-width: $border-stroke-width-thin;
fill: $brand-header;
}

&:hover .slds-icon,
&:hover .slds-button__icon,
&:focus .slds-icon,
&:focus .slds-button__icon {
color: $brand-header;
stroke: $brand-accessible-active;
fill: $brand-header;
}

&:active .slds-icon,
&:active .slds-button__icon {
color: $brand-header;
stroke: $brand-accessible-active;
fill: $brand-header;
}
}

/**
* Disabled state for favorites button
*
* @selector .slds-is-disabled
* @restrict .slds-global-header__button_icon-favorites
* @deprecated
*/
&.slds-is-disabled .slds-icon,
&.slds-is-disabled .slds-button__icon,
&:disabled .slds-icon,
&:disabled .slds-button__icon {
stroke: $brand-header-icon-disabled;
}
}

/**
* Disabled state for favorites button
*
* @selector .slds-is-disabled
* @restrict .slds-global-header__button_icon-favorites
* @modifier
*/
&.slds-is-disabled .slds-icon,
&.slds-is-disabled .slds-button__icon,
&:disabled .slds-icon,
&:disabled .slds-button__icon {
stroke: $brand-header-icon-disabled;
* Deal with sizing for global header icons
*
* @selector .global-header__icon
* @restrict .slds-global-header__item svg
* @deprecated
*/
&__icon,
&__icon .slds-icon,
&__icon .slds-button__icon {
@include square($square-icon-global-identity-icon);
}
}

/**
* Deal with sizing for global header icons
*
* @selector .global-header__icon
* @restrict .slds-global-header__item svg
* @required
*/
&__icon,
&__icon .slds-icon,
&__icon .slds-button__icon {
@include square($square-icon-global-identity-icon);
}
}

0 comments on commit 399da9c

Please sign in to comment.