Skip to content
Snippets Groups Projects
Commit e4b4e98d authored by Chris Lawton's avatar Chris Lawton Committed by Todd Dembrey
Browse files

move last item list logic to grouped listing component

parent 1f2f609d
No related branches found
No related tags found
No related merge requests found
...@@ -114,6 +114,11 @@ export default class GroupedListing extends React.Component { ...@@ -114,6 +114,11 @@ export default class GroupedListing extends React.Component {
error error
}; };
// set css custom prop to allow scrolling from dropdown to last item in the list
if (this.listRef.current) {
document.documentElement.style.setProperty('--last-listing-item-height', this.listRef.current.lastElementChild.offsetHeight + 'px');
}
return ( return (
<div className="grouped-listing"> <div className="grouped-listing">
<div className="grouped-listing__dropdown" ref={(ref) => this.dropdownContainer = ref}> <div className="grouped-listing__dropdown" ref={(ref) => this.dropdownContainer = ref}>
......
...@@ -20,10 +20,6 @@ export default class Listing extends React.Component { ...@@ -20,10 +20,6 @@ export default class Listing extends React.Component {
column: PropTypes.string, column: PropTypes.string,
}; };
componentDidUpdate() {
this.setLastItemHeight();
}
renderListItems() { renderListItems() {
const { const {
isError, isError,
...@@ -50,8 +46,6 @@ export default class Listing extends React.Component { ...@@ -50,8 +46,6 @@ export default class Listing extends React.Component {
); );
} }
this.setLastItemHeight();
return ( return (
<ul className={`listing__list listing__list--${column}`} ref={listRef}> <ul className={`listing__list listing__list--${column}`} ref={listRef}>
{items.map(v => renderItem(v))} {items.map(v => renderItem(v))}
...@@ -71,14 +65,6 @@ export default class Listing extends React.Component { ...@@ -71,14 +65,6 @@ export default class Listing extends React.Component {
); );
} }
// set css custom prop to allow scrolling from dropdown to last item in the list
setLastItemHeight() {
// const { listRef } = this.props;
// if (listRef.current) {
// document.documentElement.style.setProperty('--last-listing-item-height', listRef.current.lastElementChild.offsetHeight + 'px');
// }
}
render() { render() {
return ( return (
<div className="listing"> <div className="listing">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment