Skip to content

Commit

Permalink
adds prop to wrap EuiListItem text
Browse files Browse the repository at this point in the history
  • Loading branch information
ryankeairns committed Jan 18, 2019
1 parent 59622f6 commit cc06303
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Changes `EuiNavDrawerFLyout` links to wrap ([#1457](https://github.com/elastic/eui/pull/1457))
- Adds `isWrappable` prop that wraps `EuiListGroupItem` text ([#1458](https://github.com/elastic/eui/pull/1458))

## [`6.5.1`](https://github.com/elastic/eui/tree/v6.5.1)

Expand Down
5 changes: 4 additions & 1 deletion src-docs/src/views/nav_drawer/nav_drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ export default class extends Component {
size: 's',
style: { color: 'inherit' },
'aria-label': 'My dashboard',
isWrappable: true,
extraAction: {
color: 'subdued',
iconType: 'starEmpty',
Expand All @@ -342,7 +343,8 @@ export default class extends Component {
iconType: 'canvasApp',
size: 's',
style: { color: 'inherit' },
'aria-label': 'My workpad',
'aria-label': 'Workpad with title that wraps',
isWrappable: true,
extraAction: {
color: 'subdued',
iconType: 'starEmpty',
Expand All @@ -357,6 +359,7 @@ export default class extends Component {
size: 's',
style: { color: 'inherit' },
'aria-label': 'My logs',
isWrappable: true,
extraAction: {
color: 'subdued',
iconType: 'starEmpty',
Expand Down
12 changes: 12 additions & 0 deletions src/components/list_group/_list_group_item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@
font-size: $euiFontSizeL;
}

.euiListGroupItem-isWrappable {
.euiListGroupItem__button {
width: 100%;
word-break: break-word;
line-height: $euiSize;
}

.euiListGroupItem__icon {
min-width: $euiSize;
}
}

// Layout alts from euiListGroup

.euiListGroup-flush .euiListGroupItem {
Expand Down
8 changes: 8 additions & 0 deletions src/components/list_group/list_group_item.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const EuiListGroupItem = ({
label,
isActive,
isDisabled,
isWrappable,
href,
className,
iconType,
Expand All @@ -33,6 +34,7 @@ export const EuiListGroupItem = ({
'euiListGroupItem-isActive': isActive,
'euiListGroupItem-isDisabled': isDisabled,
'euiListGroupItem-isClickable': href || onClick,
'euiListGroupItem-isWrappable': isWrappable,
},
className
);
Expand Down Expand Up @@ -126,6 +128,11 @@ EuiListGroupItem.propTypes = {
*/
isDisabled: PropTypes.bool,

/**
* Allow link text to wrap
*/
isWrappable: PropTypes.bool,

/**
* Make the list item label a link
*/
Expand All @@ -151,5 +158,6 @@ EuiListGroupItem.propTypes = {
EuiListGroupItem.defaultProps = {
isActive: false,
isDisabled: false,
isWrappable: false,
size: 'm',
};
10 changes: 0 additions & 10 deletions src/components/nav_drawer/_nav_drawer_flyout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,4 @@
padding-left: 0;
padding-right: 0;
}

.euiListGroupItem__button {
width: 100%;
word-break: break-word;
line-height: $euiSize;
}

.euiListGroupItem__icon {
min-width: $euiSize;
}
}

0 comments on commit cc06303

Please sign in to comment.