Skip to content

Commit

Permalink
Some random fixes (#546)
Browse files Browse the repository at this point in the history
See PR fo full details.
  • Loading branch information
cchaos authored Mar 22, 2018
1 parent 0177c98 commit f47e4ec
Show file tree
Hide file tree
Showing 27 changed files with 215 additions and 44 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
**Bug fixes**

- Fixed `EuiToolTip` bug which caused the tooltip to hide when moving the mouse around inside of the trigger element ([#557](https://github.com/elastic/eui/pull/557))
- Added a `buttonColor` prop to `EuiConfirmModal` ([#546](https://github.com/elastic/eui/pull/546))
- Added ‘baseline’ as option to `EuiFlexGroup`'s `alignItems` prop ([#546](https://github.com/elastic/eui/pull/546))

# [`0.0.33`](https://github.com/elastic/eui/tree/v0.0.33)

- Added initial sorting option to `EuiInMemoryTable` ([#547](https://github.com/elastic/eui/pull/547))
- Horizontally scrolling `EuiTabs` ([#546](https://github.com/elastic/eui/pull/546))
- Remove padding from both sides of `EuiEmptyButton` ([#546](https://github.com/elastic/eui/pull/546))
- Added `disabled` prop to placeholder (ellipses) button in pagination ([#546](https://github.com/elastic/eui/pull/546))
- Converted `.euiHeader__notification` into `EuiHeaderNotification` ([#546](https://github.com/elastic/eui/pull/546))

**Bug fixes**

Expand Down
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
40 changes: 40 additions & 0 deletions src-docs/src/views/modal/confirm_modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ export class ConfirmModal extends Component {

this.state = {
isModalVisible: false,
isDestroyModalVisible: false,
};

this.closeModal = this.closeModal.bind(this);
this.showModal = this.showModal.bind(this);

this.closeDestroyModal = this.closeDestroyModal.bind(this);
this.showDestroyModal = this.showDestroyModal.bind(this);
}

closeModal() {
Expand All @@ -29,6 +33,14 @@ export class ConfirmModal extends Component {
this.setState({ isModalVisible: true });
}

closeDestroyModal() {
this.setState({ isDestroyModalVisible: false });
}

showDestroyModal() {
this.setState({ isDestroyModalVisible: true });
}

render() {
let modal;

Expand All @@ -50,13 +62,41 @@ export class ConfirmModal extends Component {
);
}

let destroyModal;

if (this.state.isDestroyModalVisible) {
destroyModal = (
<EuiOverlayMask>
<EuiConfirmModal
title="Do this destructive thing"
onCancel={this.closeDestroyModal}
onConfirm={this.closeDestroyModal}
cancelButtonText="No, don't do it"
confirmButtonText="Yes, do it"
buttonColor="danger"
defaultFocusedButton={EUI_MODAL_CONFIRM_BUTTON}
>
<p>You&rsquo;re about to destroy something.</p>
<p>Are you sure you want to do this?</p>
</EuiConfirmModal>
</EuiOverlayMask>
);
}

return (
<div>
<EuiButton onClick={this.showModal}>
Show ConfirmModal
</EuiButton>

&nbsp;

<EuiButton onClick={this.showDestroyModal}>
Show dangerous ConfirmModal
</EuiButton>

{modal}
{destroyModal}
</div>
);
}
Expand Down
2 changes: 0 additions & 2 deletions src-docs/src/views/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,12 @@ export class Modal extends Component {
<EuiModalFooter>
<EuiButtonEmpty
onClick={this.closeModal}
size="s"
>
Cancel
</EuiButtonEmpty>

<EuiButton
onClick={this.closeModal}
size="s"
fill
>
Save
Expand Down
33 changes: 17 additions & 16 deletions src-docs/src/views/modal/modal_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,28 @@ export const ModalExample = {
}],
text: (
<p>
Use the <EuiCode>EuiConfirmModal</EuiCode> to ask the user to confirm a decision,
typically one which is destructive and potentially regrettable.
Use the <EuiCode>EuiConfirmModal</EuiCode> to ask the user to confirm a decision.
The default type is a positive or neutral confirmation. To change the main button color
change the the <EuiCode>buttonColor</EuiCode> property to any of the button color options.
</p>
),
props: { EuiConfirmModal },
demo: <ConfirmModal />,
}, {
title: 'Overflow overflow test',
source: [{
type: GuideSectionTypes.JS,
code: overflowTestSource,
}, {
title: 'Overflow overflow test',
source: [{
type: GuideSectionTypes.JS,
code: overflowTestSource,
}, {
type: GuideSectionTypes.HTML,
code: overflowTestHtml,
}],
text: (
<p>
type: GuideSectionTypes.HTML,
code: overflowTestHtml,
}],
text: (
<p>
This demo is to test long overflowing body content.
</p>
),
props: { EuiConfirmModal },
demo: <OverflowTest />,
</p>
),
props: { EuiConfirmModal },
demo: <OverflowTest />,
}],
};
2 changes: 0 additions & 2 deletions src-docs/src/views/modal/overflow_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,12 @@ export class OverflowTest extends Component {
<EuiModalFooter>
<EuiButtonEmpty
onClick={this.closeModal}
size="s"
>
Cancel
</EuiButtonEmpty>

<EuiButton
onClick={this.closeModal}
size="s"
fill
>
Save
Expand Down
6 changes: 6 additions & 0 deletions src/components/button/button_empty/_button_empty.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,21 @@ $buttonTypes: (
}

.euiButtonEmpty--flushLeft {
margin-right: $euiSizeS;

.euiButtonEmpty__content {
border-left: none;
padding-left: 0;
padding-right: 0;
}
}

.euiButtonEmpty--flushRight {
margin-left: $euiSizeS;

.euiButtonEmpty__content {
border-right: none;
padding-left: 0;
padding-right: 0;
}
}
6 changes: 6 additions & 0 deletions src/components/flex/__snapshots__/flex_group.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ exports[`EuiFlexGroup is rendered 1`] = `
</div>
`;

exports[`EuiFlexGroup props alignItems baseline is rendered 1`] = `
<div
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--alignItemsBaseline euiFlexGroup--responsive"
/>
`;

exports[`EuiFlexGroup props alignItems center is rendered 1`] = `
<div
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--alignItemsCenter euiFlexGroup--responsive"
Expand Down
5 changes: 5 additions & 0 deletions src/components/flex/_flex_group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ $gutterTypes: (
align-items: flex-end;
}

.euiFlexGroup--alignItemsBaseline {
align-items: baseline;
}

// Wrap
.euiFlexGroup--wrap {
flex-wrap: wrap;
}
Expand Down
1 change: 1 addition & 0 deletions src/components/flex/flex_group.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const alignItemsToClassNameMap = {
flexStart: 'euiFlexGroup--alignItemsFlexStart',
flexEnd: 'euiFlexGroup--alignItemsFlexEnd',
center: 'euiFlexGroup--alignItemsCenter',
baseline: 'euiFlexGroup--alignItemsBaseline',
};

export const ALIGN_ITEMS = Object.keys(alignItemsToClassNameMap);
Expand Down
3 changes: 1 addition & 2 deletions src/components/flyout/_flyout_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
flex-grow: 0;
padding: $euiSizeL;
padding-bottom: 0;
box-shadow: 0 $euiSize $euiSize (-$euiSize / 2) $euiColorEmptyShade;
z-index: 2;
@include euiOverflowShadowBottom;
}
1 change: 1 addition & 0 deletions src/components/form/switch/_switch.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
padding-left: $euiSizeS;
line-height: $euiSwitchHeight;
font-size: $euiFontSizeS;
vertical-align: middle;
}

/**
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
4 changes: 2 additions & 2 deletions src/components/modal/__snapshots__/confirm_modal.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ exports[`renders EuiConfirmModal 1`] = `
class="euiModalFooter"
>
<button
class="euiButtonEmpty euiButtonEmpty--primary euiButtonEmpty--small"
class="euiButtonEmpty euiButtonEmpty--primary"
data-test-subj="confirmModalCancelButton"
type="button"
>
Expand All @@ -73,7 +73,7 @@ exports[`renders EuiConfirmModal 1`] = `
</span>
</button>
<button
class="euiButton euiButton--primary euiButton--small euiButton--fill"
class="euiButton euiButton--primary euiButton--fill"
data-test-subj="confirmModalConfirmButton"
type="button"
>
Expand Down
Loading

0 comments on commit f47e4ec

Please sign in to comment.