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

Added more css text utilities #1092

Merged
merged 4 commits into from
Aug 7, 2018
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Added `repositionOnScroll` prop to `EuiPopover` which enables repositioning the popover when the window is scrolled. ([#1064](https://github.com/elastic/eui/pull/1064))
- Allow `_` and `*` characters to be used in `EuiSearchBar` query terms ([#1058](https://github.com/elastic/eui/pull/1058))
- Added more `status` options for `EuiSteps` ([#1088](https://github.com/elastic/eui/pull/1088))
- Added more `.eui-textBreakNormal` and `@mixin euiTextTruncate` as CSS/SASS utilities ([#1092](https://github.com/elastic/eui/pull/1092))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy/pasta "more".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hehe


**Bug fixes**

Expand Down
6 changes: 3 additions & 3 deletions src-docs/src/components/guide_section/guide_section.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export class GuideSection extends Component {
} = props[propName];

let humanizedName = (
<strong className="eui-textNoWrap">{propName}</strong>
<strong className="eui-textBreakNormal">{propName}</strong>
);

if (required) {
Expand All @@ -175,13 +175,13 @@ export class GuideSection extends Component {

const humanizedType = humanizeType(type);

const typeMarkup = (<span className="eui-textNoWrap">{markup(humanizedType)}</span>);
const typeMarkup = (<span className="eui-textBreakNormal">{markup(humanizedType)}</span>);
const descriptionMarkup = markup(propDescription);
let defaultValueMarkup = '';
if (defaultValue) {
defaultValueMarkup = [(
<EuiCode key={`defaultValue-${propName}`}>
<span className="eui-textNoWrap">{defaultValue.value}</span>
<span className="eui-textBreakNormal">{defaultValue.value}</span>
</EuiCode>
)];
if (defaultValue.comment) {
Expand Down
19 changes: 19 additions & 0 deletions src/global_styling/mixins/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,22 @@
line-height: 1.25;
font-weight: $euiFontWeightLight; // always apply light weight to x-large type
}

/**
* Text truncation
*
* Prevent text from wrapping onto multiple lines, and truncate with an
* ellipsis.
*
* 1. Ensure that the node has a maximum width after which truncation can
* occur.
* 2. Fix for IE 8/9 if `word-wrap: break-word` is in effect on ancestor
* nodes.
*/
@mixin euiTextTruncate {
max-width: 100%; /* 1 */
overflow: hidden !important;
text-overflow: ellipsis !important;
white-space: nowrap !important;
word-wrap: normal !important; /* 2 */
}
20 changes: 3 additions & 17 deletions src/global_styling/utility/_utility.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,15 @@
.eui-textNoWrap {white-space: nowrap !important;}
.eui-textInheritColor {color: inherit !important;}

.eui-textBreakAll {word-break: break-all !important;}
.eui-textBreakWord {
word-break: break-all !important; // Fallback for FF and IE
word-break: break-word !important;
}
.eui-textBreakAll {word-break: break-all !important;}
.eui-textBreakNormal {word-break: normal !important;}

/**
* Text truncation
*
* Prevent text from wrapping onto multiple lines, and truncate with an
* ellipsis.
*
* 1. Ensure that the node has a maximum width after which truncation can
* occur.
* 2. Fix for IE 8/9 if `word-wrap: break-word` is in effect on ancestor
* nodes.
*/
.eui-textTruncate {
max-width: 100%; /* 1 */
overflow: hidden !important;
text-overflow: ellipsis !important;
white-space: nowrap !important;
word-wrap: normal !important; /* 2 */
@include euiTextTruncate;
}

/**
Expand Down