Skip to content

Commit

Permalink
add separator for Browse facets: MultiSelectionFacet - for member ten…
Browse files Browse the repository at this point in the history
…ant only, EffectiveLocationFacet - for consortia
  • Loading branch information
Dmytro-Melnyshyn committed Jun 14, 2024
1 parent eb80a7d commit fbf0071
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/components/InstanceFiltersBrowse/InstanceFiltersBrowse.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import omit from 'lodash/omit';

import {
checkIfUserInMemberTenant,
useStripes,
} from '@folio/stripes/core';
import { AccordionSet } from '@folio/stripes/components';
import {
FACETS,
Expand All @@ -14,6 +18,7 @@ import {
FACETS_TO_REQUEST,
SharedFacet,
EffectiveLocationFacet,
isConsortiaEnv,
} from '@folio/stripes-inventory-components';

import { MultiSelectionFacet } from '../MultiSelectionFacet';
Expand All @@ -27,6 +32,7 @@ const InstanceFiltersBrowse = props => {
} = props;

const intl = useIntl();
const stripes = useStripes();
const qindex = query.qindex;

const initialAccordionStates = useMemo(() => ({
Expand Down Expand Up @@ -97,6 +103,7 @@ const InstanceFiltersBrowse = props => {
<EffectiveLocationFacet
name={FACETS.EFFECTIVE_LOCATION}
facetOptions={facetOptions}
separator={isConsortiaEnv(stripes)}
activeFilters={activeFilters}
getIsLoading={getIsLoading}
onChange={onChange}
Expand All @@ -116,6 +123,7 @@ const InstanceFiltersBrowse = props => {
label={intl.formatMessage({ id: `ui-inventory.filters.${FACETS.NAME_TYPE}` })}
name={FACETS.NAME_TYPE}
closedByDefault
separator={checkIfUserInMemberTenant(stripes)}
options={facetOptions[FACETS_TO_REQUEST[FACETS.NAME_TYPE]]}
selectedValues={activeFilters[FACETS.NAME_TYPE]}
onFilterChange={onChange}
Expand Down
3 changes: 3 additions & 0 deletions src/components/MultiSelectionFacet/MultiSelectionFacet.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const propTypes = {
onClearFilter: PropTypes.func.isRequired,
onFilterChange: PropTypes.func.isRequired,
closedByDefault: PropTypes.bool,
separator: PropTypes.bool,
options: PropTypes.arrayOf(PropTypes.shape({
id: PropTypes.string.isRequired,
label: PropTypes.string,
Expand All @@ -29,6 +30,7 @@ const MultiSelectionFacet = ({
label,
name,
closedByDefault = true,
separator = true,
options,
selectedValues,
onFilterChange,
Expand Down Expand Up @@ -74,6 +76,7 @@ const MultiSelectionFacet = ({
label={label}
id={id}
closedByDefault={closedByDefault}
separator={separator}
header={FilterAccordionHeader}
headerProps={{ label }}
onClearFilter={() => onClearFilter(name)}
Expand Down

0 comments on commit fbf0071

Please sign in to comment.