diff --git a/webpack/assets/javascripts/react_app/components/PF4/Bookmarks/BookmarkItems.js b/webpack/assets/javascripts/react_app/components/PF4/Bookmarks/BookmarkItems.js index 8b286cf329d..722cfd37155 100644 --- a/webpack/assets/javascripts/react_app/components/PF4/Bookmarks/BookmarkItems.js +++ b/webpack/assets/javascripts/react_app/components/PF4/Bookmarks/BookmarkItems.js @@ -1,5 +1,4 @@ import React from 'react'; -import EllipisWithTooltip from 'react-ellipsis-with-tooltip'; import { PlusIcon } from '@patternfly/react-icons'; import { DropdownItem, @@ -10,6 +9,7 @@ import { import { sprintf, translate as __ } from '../../../common/I18n'; import { STATUS } from '../../../constants'; import DocumentationUrl from '../DocumentationLink'; +import './bookmarks.scss'; export const addBookmarkItem = ({ setModalOpen }) => ( @@ -39,27 +39,40 @@ const pendingItem = ( ); -const bookmarksList = ({ bookmarks, onBookmarkClick }) => - (bookmarks.length > 0 && - bookmarks.map(({ name, query }) => ( - onBookmarkClick(query)} - > - {name} +const bookmarksList = ({ bookmarks, onBookmarkClick }) => { + const hasLongerName = bookmarks.some(bookmark => bookmark.name.length > 90); + + return ( + (bookmarks.length > 0 && + bookmarks.map(({ name, query }) => ( + onBookmarkClick(query)} + > + {name} + + ))) || ( + + {__('None found')} - ))) || ( - - {__('None found')} - + ) ); +}; const errorItem = errors => ( - - - {sprintf('Failed to load bookmarks: %s', errors)} - + 90 ? 'adapt-long-bookmark' : '' + }`} + key="bookmarks-errors" + isDisabled + > + {sprintf('Failed to load bookmarks: %s', errors)} ); diff --git a/webpack/assets/javascripts/react_app/components/PF4/Bookmarks/bookmarks.scss b/webpack/assets/javascripts/react_app/components/PF4/Bookmarks/bookmarks.scss new file mode 100644 index 00000000000..b41b45aad74 --- /dev/null +++ b/webpack/assets/javascripts/react_app/components/PF4/Bookmarks/bookmarks.scss @@ -0,0 +1,26 @@ +@import '~@theforeman/vendor/scss/variables'; + +.bookmarks-dropdown-item { + word-break: break-word; + overflow-wrap: break-word; + white-space: nowrap; +} + +.bookmarks-dropdown-item.adapt-long-bookmark { + width: 450px; + white-space: normal; +} + +@media only screen and (min-width: $pf-global--breakpoint--xl) { + .bookmarks-dropdown-item.adapt-long-bookmark { + width: 600px; + white-space: normal; + } +} + +@media only screen and (min-width: $pf-global--breakpoint--2xl) { + .bookmarks-dropdown-item.adapt-long-bookmark { + width: 700px; + white-space: normal; + } +}