Skip to content

Commit

Permalink
elastic#87 Converted .euiHeader__notification into `EuiHeaderNotifi…
Browse files Browse the repository at this point in the history
…cation`
  • Loading branch information
cchaos committed Mar 22, 2018
1 parent 525cade commit 0b3f63f
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src-docs/src/views/header/header_user_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
EuiFlexItem,
EuiHeaderAlert,
EuiHeaderSectionItemButton,
EuiHeaderNotification,
EuiIcon,
EuiLink,
EuiText,
Expand Down Expand Up @@ -44,9 +45,7 @@ export default class extends Component {
size="m"
/>

<span className="euiHeader__notification">
3
</span>
<EuiHeaderNotification>3</EuiHeaderNotification>
</EuiHeaderSectionItemButton>
);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`EuiHeaderNotification is rendered 1`] = `
<span
aria-label="aria-label"
class="euiHeaderNotification testClass1 testClass2"
data-test-subj="test subject string"
>
Content
</span>
`;
12 changes: 12 additions & 0 deletions src/components/header/_header_notification.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

.euiHeaderNotification {
display: inline-block;
border-radius: $euiBorderRadius;
background: $euiHeaderNotificationBackgroundColor;
color: $euiColorEmptyShade;
font-size: $euiFontSizeXS;
line-height: $euiSize;
height: $euiSize;
min-width: $euiSize;
vertical-align: middle;
}
1 change: 1 addition & 0 deletions src/components/header/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ $euiHeaderChildSize: $euiSizeXXL + $euiSizeL;
@import 'header_popover';
@import 'header_profile';
@import 'header_logo';
@import 'header_notification';
@import 'header_alert/index';
@import 'header_breadcrumbs/index';
@import 'header_section/index';
15 changes: 15 additions & 0 deletions src/components/header/header_notification.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import classNames from 'classnames';

export const EuiHeaderNotification = ({ children, className, ...rest }) => {
const classes = classNames('euiHeaderNotification', className);

return (
<span
className={classes}
{...rest}
>
{children}
</span>
);
};
18 changes: 18 additions & 0 deletions src/components/header/header_notification.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import { render } from 'enzyme';
import { requiredProps } from '../../test/required_props';

import { EuiHeaderNotification } from './header_notification';

describe('EuiHeaderNotification', () => {
test('is rendered', () => {
const component = render(
<EuiHeaderNotification {...requiredProps}>
Content
</EuiHeaderNotification>
);

expect(component)
.toMatchSnapshot();
});
});
4 changes: 4 additions & 0 deletions src/components/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export {
EuiHeaderLogo,
} from './header_logo';

export {
EuiHeaderNotification,
} from './header_notification';

export {
EuiHeaderSection,
EuiHeaderSectionItem,
Expand Down
1 change: 1 addition & 0 deletions src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export {
EuiHeaderBreadcrumbCollapsed,
EuiHeaderBreadcrumbs,
EuiHeaderLogo,
EuiHeaderNotification,
EuiHeaderSection,
EuiHeaderSectionItem,
EuiHeaderSectionItemButton,
Expand Down

0 comments on commit 0b3f63f

Please sign in to comment.