Skip to content

Commit

Permalink
added prop
Browse files Browse the repository at this point in the history
  • Loading branch information
andreadelrio committed May 12, 2020
1 parent c4d93cd commit faaa6ad
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions src-docs/src/views/expression/truncate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export default class extends Component<TruncateProps, TruncateState> {
<EuiPopover
button={
<EuiExpression
truncate={true}
style={{ maxWidth: '220px' }}
description="Average of"
value={this.state.value}
Expand Down
6 changes: 5 additions & 1 deletion src/components/expression/_expression.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// @include euiTextBreakWord; /* 1 */
@include euiFontSizeS;
@include euiCodeFont;
@include euiTextTruncate;

display: inline-block; /* 1 */
text-align: left;
Expand All @@ -25,9 +24,14 @@
}

.euiExpression-isUppercase .euiExpression__description {
@include euiTextTruncate;
text-transform: uppercase;
}

.euiExpression-isTruncate {
@include euiTextTruncate;
}

.euiExpression-isClickable {
cursor: pointer;
border-bottom: $euiBorderEditable;
Expand Down
6 changes: 6 additions & 0 deletions src/components/expression/expression.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ export type EuiExpressionProps = CommonProps & {
* Turns the component into a button and adds an editable style border at the bottom
*/
onClick?: MouseEventHandler<HTMLButtonElement>;
/**
* Truncates text
*/
truncate?: boolean;
};

type Buttonlike = EuiExpressionProps &
Expand All @@ -85,6 +89,7 @@ export const EuiExpression: React.FunctionComponent<
valueProps,
color = 'secondary',
uppercase = true,
truncate = false,
isActive = false,
onClick,
...rest
Expand All @@ -96,6 +101,7 @@ export const EuiExpression: React.FunctionComponent<
'euiExpression-isActive': isActive,
'euiExpression-isClickable': onClick,
'euiExpression-isUppercase': uppercase,
'euiExpression-isTruncate': truncate,
},
colorToClassNameMap[color]
);
Expand Down

0 comments on commit faaa6ad

Please sign in to comment.