Skip to content

Commit

Permalink
update multiselect loader position (#2120)
Browse files Browse the repository at this point in the history
* reposition multiselect loader animation so it always appears on top [CV2-2502]

* sort prop types for science [CV2-2502]
  • Loading branch information
brianfleming authored Sep 20, 2024
1 parent a90796b commit 8923fe5
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/app/components/cds/menus-lists-dialogs/TagPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const TagPicker = ({
}
hasMore={hasMore}
inputPlaceholder={placeholder}
loadingIcon={loading && <MediasLoading size="small" theme="white" variant="inline" />}
loadingIcon={loading && <MediasLoading size="small" theme="grey" variant="inline" />}
notFoundLabel={
<FormattedMessage
defaultMessage="No tags found"
Expand Down
11 changes: 7 additions & 4 deletions src/app/components/layout/MultiSelector.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/sort-prop-types */
import React from 'react';
import PropTypes from 'prop-types';
import FormGroup from '@material-ui/core/FormGroup';
Expand Down Expand Up @@ -209,6 +208,11 @@ class MultiSelector extends React.Component {
</div>
}
</div>
{ this.props.loadingIcon &&
<div className={styles['multiselector-scroller-loader']}>
{ this.props.loadingIcon }
</div>
}
<div className={styles['multiselector-scroller']}>
<InfiniteScroll
hasMore={hasMore}
Expand Down Expand Up @@ -265,7 +269,6 @@ class MultiSelector extends React.Component {
</div>
}
</FormGroup>
{ this.props.loadingIcon }
</InfiniteScroll>
</div>
{ this.props.children }
Expand Down Expand Up @@ -332,15 +335,15 @@ MultiSelector.propTypes = {
color: PropTypes.string,
parent: PropTypes.string,
})).isRequired,
resetLabel: PropTypes.node,
selected: PropTypes.arrayOf(PropTypes.string).isRequired,
submitLabel: PropTypes.node.isRequired,
toggleAllLabel: PropTypes.node,
onDismiss: PropTypes.func,
onScrollBottom: PropTypes.func,
onSearchChange: PropTypes.func,
onSelectChange: PropTypes.func,
onSubmit: PropTypes.func.isRequired,
toggleAllLabel: PropTypes.node,
resetLabel: PropTypes.node,
};

export default MultiSelector;
10 changes: 10 additions & 0 deletions src/app/components/layout/MultiSelector.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@
}
}

.multiselector-scroller-loader {
background-color: var(--overlayWhite);
height: 100%;
left: 0;
max-height: 320px;
position: absolute;
right: 0;
z-index: 1;
}

.multiselector-scroller {
background-color: var(--color-gray-96);
height: 320px;
Expand Down
21 changes: 10 additions & 11 deletions src/app/components/search/MultiSelectFilter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/sort-prop-types */
import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
Expand Down Expand Up @@ -252,7 +251,7 @@ const CustomSelectDropdown = ({
allowSearch={allowSearch}
hasMore={hasMore}
inputPlaceholder={inputPlaceholder || placeholder}
loadingIcon={loading && <MediasLoading size="small" theme="white" variant="inline" />}
loadingIcon={loading && <MediasLoading size="small" theme="grey" variant="inline" />}
notFoundLabel={!loading && inputPlaceholder ? (
<FormattedMessage
defaultMessage="No results matching {keyword}."
Expand Down Expand Up @@ -300,31 +299,31 @@ MultiSelectFilter.defaultProps = {
};

MultiSelectFilter.propTypes = {
allowSearch: PropTypes.bool,
error: PropTypes.arrayOf(PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
])),
allowSearch: PropTypes.bool,
extraInputs: PropTypes.node,
icon: PropTypes.element.isRequired,
inputPlaceholder: PropTypes.string,
label: PropTypes.node.isRequired,
loading: PropTypes.bool,
oneOption: PropTypes.bool,
options: PropTypes.arrayOf(PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
])).isRequired,
label: PropTypes.node.isRequired,
icon: PropTypes.element.isRequired,
loading: PropTypes.bool,
onChange: PropTypes.func,
onRemove: PropTypes.func,
readOnly: PropTypes.bool,
selected: PropTypes.oneOfType([
PropTypes.array,
PropTypes.string,
]),
onChange: PropTypes.func,
onRemove: PropTypes.func,
onScrollBottom: PropTypes.func,
onToggleOperator: PropTypes.func,
readOnly: PropTypes.bool,
onType: PropTypes.func,
inputPlaceholder: PropTypes.string,
oneOption: PropTypes.bool,
};

export default MultiSelectFilter;
2 changes: 2 additions & 0 deletions src/app/styles/css/mixins/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@

--grayShadow: rgb(0 0 0 / .15);

--overlayWhite: rgb(255 255 255 / .7);

--overlayLight: rgb(34 34 34 / .7);

/* https://facebookbrand.com/facebookapp/advertisers-and-partners/ */
Expand Down

0 comments on commit 8923fe5

Please sign in to comment.