Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent EuiToast text from overflowing. #392

Merged
merged 1 commit into from
Feb 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
- Added component to wrap blocks of substeps `EuiSubSteps` in a shaded container. ([#375](https://github.com/elastic/eui/pull/375))
- Added horizontal steps component ([#375](https://github.com/elastic/eui/pull/375))
- Changed look and feel of pagination. Added compressed prop for smaller footprint pagination. ([#380](https://github.com/elastic/eui/pull/380))
- Added `EuiBasicTable` as an opinionated, high level component for constructing tables. Its addition deprecates `EuiTableOfRecords` which is still avaiable, but now marked for removal. ([#377](https://github.com/elastic/eui/pull/377))

**Breaking changes**
**Bug fixes**

- Adds `EuiBasicTable` as an opinionated, high level component for constructing tables. Its addition deprecates `EuiTableOfRecords` which is still avaiable, but now marked for removal. ([#377](https://github.com/elastic/eui/pull/377))
- Wrap long lines of text within the body of `EuiToast` instead of letting text overflow ([#392](https://github.com/elastic/eui/pull/392))

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

- Rename class from `euiFlexGroup--alignItemsStart` to `euiFlexGroup--alignItemsFlexStart`
- Rename class from `euiFlexGroup--alignItemsStart` to `euiFlexGroup--alignItemsFlexStart` ([#378](https://github.com/elastic/eui/pull/378))

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

Expand Down
14 changes: 7 additions & 7 deletions src-docs/src/views/toast/danger.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import React from 'react';

import {
EuiLink,
EuiToast,
} from '../../../../src/components';

const esError = 'Error: expected _scroll_id in the folling Elasticsearch response: ' +
'{"took":0,"timed_out":false,"_shards":{"total":0,"successful":0,"skipped":0,"failed":0},' +
'"hits":{"total":0,"max_score":0,"hits":[]}}';

export default () => (
<EuiToast
title="Save failed"
title="Couldn't complete the search"
color="danger"
iconType="alert"
>
<p>
Check your form for validation errors.
</p>

<p>
And some other stuff on another line, just for kicks. And <EuiLink href="#">here&rsquo;s a link</EuiLink>.
{esError}
</p>
</EuiToast>
);
1 change: 0 additions & 1 deletion src-docs/src/views/toast/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
export default () => (
<EuiToast
title="Icons should be rare"
iconType="user"
onClose={() => window.alert('Dismiss toast')}
>
<p>
Expand Down
12 changes: 9 additions & 3 deletions src-docs/src/views/toast/success.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import React from 'react';

import {
EuiButton,
EuiLink,
EuiToast,
} from '../../../../src/components';

export default () => (
<EuiToast
title="This is an example of a poor toast title. It's way too long."
title="Created report for dashboard 'Tuba Sales by Region'"
color="success"
iconType="user"
iconType="check"
>
<p>
While the layout will adjust properly for wrapping titles, they do not look particularly good.
Expand All @@ -17,7 +19,11 @@ export default () => (
</p>

<p>
You should not even need a second paragraph. Again, we are getting long winded here.
And some other stuff on another line, just for kicks. And <EuiLink href="#">here&rsquo;s a link</EuiLink>.
</p>

<EuiButton>
Download report
</EuiButton>
</EuiToast>
);
1 change: 1 addition & 0 deletions src-docs/src/views/toast/warning.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ export default () => (
<EuiToast
title="Sometimes a title is enough!"
color="warning"
iconType="help"
/>
);
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ exports[`EuiGlobalToastList props toasts is rendered 1`] = `
</svg>
</button>
<div
class="euiText euiText--small"
class="euiText euiText--small euiToastBody"
>
a
</div>
Expand Down Expand Up @@ -139,7 +139,7 @@ exports[`EuiGlobalToastList props toasts is rendered 1`] = `
</svg>
</button>
<div
class="euiText euiText--small"
class="euiText euiText--small euiToastBody"
>
b
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/toast/__snapshots__/toast.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ exports[`EuiToast is rendered 1`] = `
/>
</div>
<div
class="euiText euiText--small"
class="euiText euiText--small euiToastBody"
>
<p>
Hi
Expand Down
7 changes: 7 additions & 0 deletions src/components/toast/_toast.scss
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,10 @@ $toastTypes: (
.euiToastHeader--withBody {
margin-bottom: $euiSizeM;
}

/**
* 1. Prevent long lines from overflowing.
*/
.euiToastBody {
word-wrap: break-word; /* 1 */
}
2 changes: 1 addition & 1 deletion src/components/toast/toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const EuiToast = ({ title, color, iconType, onClose, children, className,

if (children) {
optionalBody = (
<EuiText size="s">
<EuiText size="s" className="euiToastBody">
{children}
</EuiText>
);
Expand Down